Queue instances.
| Modifier and Type | Field and Description |
|---|---|
| public static final Queue | EMPTY_QUEUE
An empty unmodifiable queue. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static < the type of the elements in the queue E> Queue | |
| public static < the type of the elements in the queue E> Queue | Returns: a predicated queuethe queue to predicate, must not be null queue, final Predicate<? super E> the predicate used to evaluate new elements, must not be null predicate)Returns a predicated (validating) queue backed by the given queue. |
| public static < the element type E> Queue | Returns: a synchronized queue backed by that queuethe queue to synchronize, must not be null queue)Returns a synchronized (thread-safe) queue backed by the given queue. |
| public static < the type of the elements in the queue E> Queue | Returns: a transformed queue backed by the given queuethe queue to predicate, must not be null queue, final Transformer<? super E, ? extends E> the transformer for the queue, must not be null transformer)Returns a transformed queue backed by the given queue. |
| public static < the type of the elements in the queue E> Queue | Returns: an unmodifiable queue backed by that queuethe queue to make unmodifiable, must not be null queue)Returns an unmodifiable queue backed by the given queue. |
| EMPTY_QUEUE | back to summary |
|---|---|
| public static final Queue<E> EMPTY_QUEUE An empty unmodifiable queue.
| |
| QueueUtils | back to summary |
|---|---|
| private QueueUtils()
| |
| emptyQueue | back to summary |
|---|---|
| public static <E> Queue Get an empty
| |
| predicatedQueue | back to summary |
|---|---|
| public static <E> Queue Returns a predicated (validating) queue backed by the given queue. Only objects that pass the test in the given predicate can be added to the queue. Trying to add an invalid object results in an IllegalArgumentException. It is important not to use the original queue after invoking this method, as it is a backdoor for adding invalid objects.
| |
| synchronizedQueue | back to summary |
|---|---|
| public static <E> Queue Returns a synchronized (thread-safe) queue backed by the given queue. In order to guarantee serial access, it is critical that all access to the backing queue is accomplished through the returned queue. It is imperative that the user manually synchronize on the returned queue when iterating over it:
Queue queue = QueueUtils.synchronizedQueue(new CircularFifoQueue());
...
synchronized(queue) {
Iterator i = queue.iterator(); // Must be in synchronized block
while (i.hasNext())
foo(i.next());
}
}
Failure to follow this advice may result in non-deterministic behavior.
| |
| transformingQueue | back to summary |
|---|---|
| public static <E> Queue Returns a transformed queue backed by the given queue. Each object is passed through the transformer as it is added to the Queue. It is important not to use the original queue after invoking this method, as it is a backdoor for adding untransformed objects.
Existing entries in the specified queue will not be transformed.
If you want that behaviour, see
| |
| unmodifiableQueue | back to summary |
|---|---|
| public static <E> Queue Returns an unmodifiable queue backed by the given queue.
| |