public class TransformedQueue<E> extends TransformedCollection<E> implements Queue <E>
Queue to transform objects that are added.
The add/offer methods are affected by this class. Thus objects must be removed or searched for using their transformed form. For example, if the transformation converts Strings to Integers, you must use the Integer form to remove objects.
transformer| Modifier | Constructor and Description |
|---|---|
protected |
TransformedQueue(Queue
Constructor that wraps (not copies).
|
| Modifier and Type | Method and Description |
|---|---|
E |
element()
|
protected Queue |
getQueue()
Gets the decorated queue.
|
boolean |
offer(E obj)
|
E |
peek()
|
E |
poll()
|
E |
remove()
|
static <E> TransformedQueue |
transformedQueue(Queue
Factory method to create a transforming queue that will transform existing contents of the specified queue.
|
static <E> TransformedQueue |
transformingQueue(Queue
Factory method to create a transforming queue.
|
add, addAll, transform, transform, transformedCollection, transformingCollectionclear, contains, containsAll, decorated, isEmpty, iterator, remove, removeAll, retainAll, setCollection, size, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArrayprotected TransformedQueue(Queue<E> queue, Transformer <? super E ,? extends E> transformer)
If there are any elements already in the queue being decorated, they are NOT transformed.
queue - the queue to decorate, must not be null
transformer - the transformer to use for conversion, must not be null
NullPointerException - if queue or transformer is null
public static <E> TransformedQueue<E> transformingQueue(Queue <E> queue, Transformer <? super E ,? extends E> transformer)
If there are any elements already in the queue being decorated, they are NOT transformed. Contrast this with transformedQueue(Queue, Transformer).
E - the type of the elements in the queue
queue - the queue to decorate, must not be null
transformer - the transformer to use for conversion, must not be null
NullPointerException - if queue or transformer is null
public static <E> TransformedQueue<E> transformedQueue(Queue <E> queue, Transformer <? super E ,? extends E> transformer)
If there are any elements already in the queue being decorated, they will be transformed by this method. Contrast this with transformingQueue(Queue, Transformer).
E - the type of the elements in the queue
queue - the queue to decorate, must not be null
transformer - the transformer to use for conversion, must not be null
NullPointerException - if queue or transformer is null
public boolean offer(E obj)
public E poll()
public E peek()
public E element()
public E remove()