T
- the type of values to storepublic class ManagedConcurrentLinkedQueue<T> extends Object implements Iterable<T>
ReferenceBundle
. References stored
in this queue will be removed when reference processing occurs.
This queue is backed by a ConcurrentLinkedQueue
and is thread safe.
The iterator will only return non-null values (reachable) and is based on
the "weakly consistent" iterator of the underlying ConcurrentLinkedQueue
.
Constructor and Description |
---|
ManagedConcurrentLinkedQueue(ReferenceBundle bundle)
Creates an empty ManagedConcurrentLinkedQueue that will use the provided
ReferenceBundle to store values as the given Reference
type. |
Modifier and Type | Method and Description |
---|---|
void |
add(T value)
Adds the specified value to the queue.
|
boolean |
isEmpty()
Returns
true if this queue contains no elements. |
Iterator<T> |
iterator()
Returns an iterator over all non-null values in this queue.
|
T[] |
toArray(T[] tArray)
Returns an array containing all values from this queue in the sequence they
were added.
|
List<T> |
values()
Returns a list containing all values from this queue in the
sequence they were added.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public ManagedConcurrentLinkedQueue(ReferenceBundle bundle)
ReferenceBundle
to store values as the given Reference
type.bundle
- used to create the appropriate Reference type
for the values storedpublic void add(T value)
value
- the value to addpublic boolean isEmpty()
true
if this queue contains no elements.
This method does not check the elements to verify they contain non-null reference values.
public T[] toArray(T[] tArray)
tArray
- the array to populate if big enough, else a new array with
the same runtime typepublic List<T> values()