|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.collections4.QueueUtils
public class QueueUtils
Provides utility methods and decorators for Queue
instances.
Field Summary | |
---|---|
static Queue<Object> |
EMPTY_QUEUE
An empty unmodifiable queue. |
Method Summary | ||
---|---|---|
static
|
emptyQueue()
Get an empty Queue . |
|
static
|
predicatedQueue(Queue<E> queue,
Predicate<? super E> predicate)
Returns a predicated (validating) queue backed by the given queue. |
|
static
|
transformingQueue(Queue<E> queue,
Transformer<? super E,? extends E> transformer)
Returns a transformed queue backed by the given queue. |
|
static
|
unmodifiableQueue(Queue<E> queue)
Returns an unmodifiable queue backed by the given queue. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Queue<Object> EMPTY_QUEUE
Method Detail |
---|
public static <E> Queue<E> unmodifiableQueue(Queue<E> queue)
E
- the type of the elements in the queuequeue
- the queue to make unmodifiable, must not be null
IllegalArgumentException
- if the Queue is nullpublic static <E> Queue<E> predicatedQueue(Queue<E> queue, Predicate<? super E> predicate)
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.
E
- the type of the elements in the queuequeue
- the queue to predicate, must not be nullpredicate
- the predicate used to evaluate new elements, must not be null
IllegalArgumentException
- if the Queue or Predicate is nullpublic static <E> Queue<E> transformingQueue(Queue<E> queue, Transformer<? super E,? extends E> transformer)
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 TransformedQueue.transformedQueue(java.util.Queue
.
E
- the type of the elements in the queuequeue
- the queue to predicate, must not be nulltransformer
- the transformer for the queue, must not be null
IllegalArgumentException
- if the Queue or Transformer is nullpublic static <E> Queue<E> emptyQueue()
Queue
.
E
- the type of the elements in the queue
Queue
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |