public class CachedCollection extends AbstractCollection
Collection
which translates added objects
into SoftObject
references, allowing the VM to garbage collect
objects in the collection when memory is low.Modifier and Type | Field and Description |
---|---|
protected Collection |
collection
Wrapped collection
|
protected ReferenceQueue |
queue
Reference queue
|
Constructor and Description |
---|
CachedCollection(Collection collection)
Construct a CachedCollection.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Object obj)
Add an object to the collection.
|
Iterator |
iterator()
Returns an iterator over the elements contained in this collection.
|
int |
size()
Returns the size of the collection.
|
addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode, parallelStream, removeIf, spliterator, stream
protected final ReferenceQueue queue
protected final Collection collection
public CachedCollection(Collection collection)
collection
- Collection to wrap.public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
iterator
in class AbstractCollection
public int size()
size
in interface Collection
size
in class AbstractCollection
public boolean add(Object obj)
add
in interface Collection
add
in class AbstractCollection
obj
- Object (or null to add to the collection.Copyright © 2018 JBoss by Red Hat. All rights reserved.