|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.collections4.collection.AbstractCollectionDecorator<E>
org.apache.commons.collections4.collection.TransformedCollection<E>
org.apache.commons.collections4.queue.TransformedQueue<E>
public class TransformedQueue<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.
Field Summary |
---|
Fields inherited from class org.apache.commons.collections4.collection.TransformedCollection |
---|
transformer |
Constructor Summary | |
---|---|
protected |
TransformedQueue(Queue<E> queue,
Transformer<? super E,? extends E> transformer)
Constructor that wraps (not copies). |
Method Summary | ||
---|---|---|
E |
element()
|
|
protected Queue<E> |
getQueue()
Gets the decorated queue. |
|
boolean |
offer(E obj)
|
|
E |
peek()
|
|
E |
poll()
|
|
E |
remove()
|
|
static
|
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
|
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.TransformedCollection |
---|
add, addAll, transform, transform, transformedCollection, transformingCollection |
Methods inherited from class org.apache.commons.collections4.collection.AbstractCollectionDecorator |
---|
clear, contains, containsAll, decorated, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, setCollection, size, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Constructor Detail |
---|
protected 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 nulltransformer
- the transformer to use for conversion, must not be null
IllegalArgumentException
- if queue or transformer is nullMethod Detail |
---|
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 queuequeue
- the queue to decorate, must not be nulltransformer
- the transformer to use for conversion, must not be null
IllegalArgumentException
- if queue or transformer is nullpublic 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 queuequeue
- the queue to decorate, must not be nulltransformer
- the transformer to use for conversion, must not be null
IllegalArgumentException
- if queue or transformer is nullprotected Queue<E> getQueue()
public boolean offer(E obj)
offer
in interface Queue<E>
public E poll()
poll
in interface Queue<E>
public E peek()
peek
in interface Queue<E>
public E element()
element
in interface Queue<E>
public E remove()
remove
in interface Queue<E>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |