public class ManagedConcurrentLinkedQueue<T> extends Object implements Iterable
A queue that stores values wrapped in a Reference, the type of which is determined by the provided 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.
T
- the type of values to storeConstructor and description |
---|
ManagedConcurrentLinkedQueue(ReferenceBundle bundle) Creates an empty ManagedConcurrentLinkedQueue that will use the provided ReferenceBundle to store values as the given Reference
type. |
Type Params | Return Type | Name and description |
---|---|---|
|
public void |
add(T value) Adds the specified value to the queue. |
|
public boolean |
isEmpty() Returns true if this queue contains no elements. |
|
public Iterator<T> |
iterator() Returns an iterator over all non-null values in this queue. |
|
public T[] |
toArray(T[] tArray) Returns an array containing all values from this queue in the sequence they were added. |
|
public List<T> |
values() Returns a list containing all values from this queue in the sequence they were added. |
Creates an empty ManagedConcurrentLinkedQueue that will use the provided
ReferenceBundle
to store values as the given Reference
type.
bundle
- used to create the appropriate Reference type
for the values storedAdds the specified value to the queue.
value
- the value to add Returns true
if this queue contains no elements.
This method does not check the elements to verify they contain non-null reference values.
Returns an iterator over all non-null values in this queue. The values should be returned in the order they were added.
Returns an array containing all values from this queue in the sequence they were added.
tArray
- the array to populate if big enough, else a new array with
the same runtime typeReturns a list containing all values from this queue in the sequence they were added.
Copyright © 2003-2024 The Apache Software Foundation. All rights reserved.