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 and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Hides org. |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected | AbstractQueueDecorator(final Queue<E>
the queue to decorate, must not be null queue)Constructor that wraps (not copies). |
| Modifier and Type | Method and Description |
|---|---|
| protected Queue | Returns: the decorated queueOverrides org. |
| public E | element()
Implements java. |
| public boolean | offer(final E
the element to add obj)Implements java. |
| public E | peek()
Implements java. null if this queue is empty.
|
| public E | poll()
Implements java. null if this queue is empty.
|
| public E |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. Serialization version | |
| AbstractQueueDecorator | back to summary |
|---|---|
| protected AbstractQueueDecorator() Constructor only used in deserialization, do not use otherwise. | |
| AbstractQueueDecorator | back to summary |
|---|---|
| protected AbstractQueueDecorator(final Queue<E> queue) Constructor that wraps (not copies).
| |
| decorated | back to summary |
|---|---|
| protected Queue Overrides org. Gets the queue being decorated. | |
| element | back to summary |
|---|---|
| public E element() Implements java. Doc from java. Retrieves, but does not remove, the head of this queue. This method
differs from
| |
| offer | back to summary |
|---|---|
| public boolean offer(final E obj) Implements java. Doc from java. Inserts the specified element into this queue if it is possible to do
so immediately without violating capacity restrictions.
When using a capacity-restricted queue, this method is generally
preferable to
| |
| peek | back to summary |
|---|---|
| public E peek() Implements java. Doc from java. Retrieves, but does not remove, the head of this queue,
or returns
| |
| poll | back to summary |
|---|---|
| public E poll() Implements java. Doc from java. Retrieves and removes the head of this queue,
or returns
| |
| remove | back to summary |
|---|---|
| public E remove() Implements java. Doc from java. Retrieves and removes the head of this queue. This method differs
from
| |