| Modifier and Type | Field and Description |
|---|---|
static Queue |
EMPTY_QUEUE
An empty unmodifiable queue.
|
| Modifier and Type | Method and Description |
|---|---|
static <E> Queue |
emptyQueue()
Get an empty
Queue.
|
static <E> Queue |
predicatedQueue(Queue
Returns a predicated (validating) queue backed by the given queue.
|
static <E> Queue |
transformingQueue(Queue
Returns a transformed queue backed by the given queue.
|
static <E> Queue |
unmodifiableQueue(Queue
Returns an unmodifiable queue backed by the given queue.
|
public static final QueueEMPTY_QUEUE
public static <E> Queue<E> unmodifiableQueue(Queue <? extends E> queue)
E - the type of the elements in the queue
queue - the queue to make unmodifiable, must not be null
NullPointerException - if the queue is null
public 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 queue
queue - the queue to predicate, must not be null
predicate - the predicate used to evaluate new elements, must not be null
NullPointerException - if the queue or predicate is null
public 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.
E - the type of the elements in the queue
queue - the queue to predicate, must not be null
transformer - the transformer for the queue, must not be null
NullPointerException - if the queue or transformer is null