E
- the type of the elements in the queuejava.lang.Iterable<E>
, java.util.Collection<E>
, java.util.Queue<E>
UnmodifiableQueue
public abstract class AbstractQueueDecorator<E> extends AbstractCollectionDecorator<E> implements java.util.Queue<E>
Queue
to provide additional behaviour.
Methods are forwarded directly to the decorated queue.
This implementation does not forward the hashCode and equals methods through to the backing object, but relies on Object's implementation. This is necessary as some Queue implementations, e.g. LinkedList, have custom a equals implementation for which symmetry can not be preserved. See class javadoc of AbstractCollectionDecorator for more information.
Modifier | Constructor | Description |
---|---|---|
protected |
AbstractQueueDecorator() |
Constructor only used in deserialization, do not use otherwise.
|
protected |
AbstractQueueDecorator(java.util.Queue<E> queue) |
Constructor that wraps (not copies).
|
Modifier and Type | Method | Description |
---|---|---|
protected java.util.Queue<E> |
decorated() |
Gets the queue being decorated.
|
E |
element() |
|
boolean |
offer(E obj) |
|
E |
peek() |
|
E |
poll() |
|
E |
remove() |
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, setCollection, size, toArray, toArray, toString
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray
protected AbstractQueueDecorator()
protected AbstractQueueDecorator(java.util.Queue<E> queue)
queue
- the queue to decorate, must not be nulljava.lang.NullPointerException
- if queue is nullprotected java.util.Queue<E> decorated()
decorated
in class AbstractCollectionDecorator<E>
Copyright © 2001-2019 - Apache Software Foundation