Class TransformedQueue<E>
java.lang.Object
org.apache.commons.collections4.collection.AbstractCollectionDecorator<E>
org.apache.commons.collections4.collection.TransformedCollection<E>
org.apache.commons.collections4.queue.TransformedQueue<E>
- Type Parameters:
- E- the type of elements held in this queue
- All Implemented Interfaces:
- Serializable,- Iterable<E>,- Collection<E>,- Queue<E>
Decorates another 
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.
- Since:
- 4.0
- See Also:
- 
Field SummaryFields inherited from class org.apache.commons.collections4.collection.TransformedCollectiontransformer
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedTransformedQueue(Queue<E> queue, Transformer<? super E, ? extends E> transformer) Constructor that wraps (not copies).
- 
Method SummaryModifier and TypeMethodDescriptionelement()getQueue()Gets the decorated queue.booleanpeek()poll()remove()static <E> TransformedQueue<E> transformedQueue(Queue<E> queue, Transformer<? super E, ? extends E> transformer) Factory method to create a transforming queue that will transform existing contents of the specified queue.static <E> TransformedQueue<E> transformingQueue(Queue<E> queue, Transformer<? super E, ? extends E> transformer) Factory method to create a transforming queue.Methods inherited from class org.apache.commons.collections4.collection.TransformedCollectionadd, addAll, transform, transform, transformedCollection, transformingCollectionMethods inherited from class org.apache.commons.collections4.collection.AbstractCollectionDecoratorclear, contains, containsAll, decorated, isEmpty, iterator, remove, removeAll, removeIf, retainAll, setCollection, size, toArray, toArray, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.CollectionaddAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray
- 
Constructor Details- 
TransformedQueueConstructor that wraps (not copies).If there are any elements already in the queue being decorated, they are NOT transformed. - Parameters:
- queue- the queue to decorate, must not be null
- transformer- the transformer to use for conversion, must not be null
- Throws:
- NullPointerException- if queue or transformer is null
 
 
- 
- 
Method Details- 
transformedQueuepublic static <E> TransformedQueue<E> transformedQueue(Queue<E> queue, Transformer<? super E, ? extends E> transformer) Factory method to create a transforming queue that will transform existing contents of the specified queue.If there are any elements already in the queue being decorated, they will be transformed by this method. Contrast this with transformingQueue(Queue, Transformer).- Type Parameters:
- E- the type of the elements in the queue
- Parameters:
- queue- the queue to decorate, must not be null
- transformer- the transformer to use for conversion, must not be null
- Returns:
- a new transformed Queue
- Throws:
- NullPointerException- if queue or transformer is null
- Since:
- 4.0
 
- 
transformingQueuepublic static <E> TransformedQueue<E> transformingQueue(Queue<E> queue, Transformer<? super E, ? extends E> transformer) Factory method to create a transforming queue.If there are any elements already in the queue being decorated, they are NOT transformed. Contrast this with transformedQueue(Queue, Transformer).- Type Parameters:
- E- the type of the elements in the queue
- Parameters:
- queue- the queue to decorate, must not be null
- transformer- the transformer to use for conversion, must not be null
- Returns:
- a new transformed Queue
- Throws:
- NullPointerException- if queue or transformer is null
 
- 
element
- 
getQueue
- 
offer
- 
peek
- 
poll
- 
remove
 
-