@GwtIncompatible public abstract class ForwardingDeque<E> extends ForwardingQueue<E> implements Deque<E>
Warning: The methods of ForwardingDeque forward indiscriminately to the
methods of the delegate. For example, overriding ForwardingCollection.add(E) alone will not change the
behavior of ForwardingQueue.offer(E) which can lead to unexpected behavior. In this case, you should
override offer as well.
default method warning: This class does not forward calls to default methods. Instead, it inherits their default implementations. When those implementations
invoke methods, they invoke methods on the ForwardingDeque.
| Modifier | Constructor and Description |
|---|---|
protected |
ForwardingDeque()
Constructor for use by subclasses.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFirst(E e)
Inserts the specified element at the front of this deque if it is
possible to do so immediately without violating capacity restrictions,
throwing an
IllegalStateException if no space is currently
available. |
void |
addLast(E e)
Inserts the specified element at the end of this deque if it is
possible to do so immediately without violating capacity restrictions,
throwing an
IllegalStateException if no space is currently
available. |
protected abstract Deque<E> |
delegate()
Returns the backing delegate instance that methods are forwarded to.
|
Iterator<E> |
descendingIterator()
Returns an iterator over the elements in this deque in reverse
sequential order.
|
E |
getFirst()
Retrieves, but does not remove, the first element of this deque.
|
E |
getLast()
Retrieves, but does not remove, the last element of this deque.
|
boolean |
offerFirst(E e)
Inserts the specified element at the front of this deque unless it would
violate capacity restrictions.
|
boolean |
offerLast(E e)
Inserts the specified element at the end of this deque unless it would
violate capacity restrictions.
|
E |
peekFirst()
Retrieves, but does not remove, the first element of this deque,
or returns
null if this deque is empty. |
E |
peekLast()
Retrieves, but does not remove, the last element of this deque,
or returns
null if this deque is empty. |
E |
pollFirst()
Retrieves and removes the first element of this deque,
or returns
null if this deque is empty. |
E |
pollLast()
Retrieves and removes the last element of this deque,
or returns
null if this deque is empty. |
E |
pop()
Pops an element from the stack represented by this deque.
|
void |
push(E e)
Pushes an element onto the stack represented by this deque (in other
words, at the head of this deque) if it is possible to do so
immediately without violating capacity restrictions, throwing an
IllegalStateException if no space is currently available. |
E |
removeFirst()
Retrieves and removes the first element of this deque.
|
boolean |
removeFirstOccurrence(Object o)
Removes the first occurrence of the specified element from this deque.
|
E |
removeLast()
Retrieves and removes the last element of this deque.
|
boolean |
removeLastOccurrence(Object o)
Removes the last occurrence of the specified element from this deque.
|
element, offer, peek, poll, remove, standardOffer, standardPeek, standardPolladd, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, standardAddAll, standardClear, standardContains, standardContainsAll, standardIsEmpty, standardRemove, standardRemoveAll, standardRetainAll, standardToArray, standardToArray, standardToString, toArray, toArraytoStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadd, contains, element, iterator, offer, peek, poll, remove, remove, sizeaddAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArrayprotected ForwardingDeque()
protected abstract Deque<E> delegate()
ForwardingObjectForwardingSet.delegate(). Concrete subclasses override this method to supply the
instance being decorated.delegate in class ForwardingQueue<E>public void addFirst(E e)
java.util.DequeIllegalStateException if no space is currently
available. When using a capacity-restricted deque, it is generally
preferable to use method Deque.offerFirst(E).public void addLast(E e)
java.util.DequeIllegalStateException if no space is currently
available. When using a capacity-restricted deque, it is generally
preferable to use method Deque.offerLast(E).
This method is equivalent to Deque.add(E).
public Iterator<E> descendingIterator()
java.util.DequedescendingIterator in interface Deque<E>public E getFirst()
java.util.DequepeekFirst only in that it
throws an exception if this deque is empty.public E getLast()
java.util.DequepeekLast only in that it
throws an exception if this deque is empty.@CanIgnoreReturnValue public boolean offerFirst(E e)
java.util.DequeDeque.addFirst(E) method,
which can fail to insert an element only by throwing an exception.offerFirst in interface Deque<E>e - the element to addtrue if the element was added to this deque, else
false@CanIgnoreReturnValue public boolean offerLast(E e)
java.util.DequeDeque.addLast(E) method,
which can fail to insert an element only by throwing an exception.public E peekFirst()
java.util.Dequenull if this deque is empty.public E peekLast()
java.util.Dequenull if this deque is empty.@CanIgnoreReturnValue public E pollFirst()
java.util.Dequenull if this deque is empty.@CanIgnoreReturnValue public E pollLast()
java.util.Dequenull if this deque is empty.@CanIgnoreReturnValue public E pop()
java.util.DequeThis method is equivalent to Deque.removeFirst().
public void push(E e)
java.util.DequeIllegalStateException if no space is currently available.
This method is equivalent to Deque.addFirst(E).
@CanIgnoreReturnValue public E removeFirst()
java.util.DequepollFirst only in that it throws an
exception if this deque is empty.removeFirst in interface Deque<E>@CanIgnoreReturnValue public E removeLast()
java.util.DequepollLast only in that it throws an
exception if this deque is empty.removeLast in interface Deque<E>@CanIgnoreReturnValue public boolean removeFirstOccurrence(Object o)
java.util.Dequee such that
(o==null ? e==null : o.equals(e))
(if such an element exists).
Returns true if this deque contained the specified element
(or equivalently, if this deque changed as a result of the call).removeFirstOccurrence in interface Deque<E>o - element to be removed from this deque, if presenttrue if an element was removed as a result of this call@CanIgnoreReturnValue public boolean removeLastOccurrence(Object o)
java.util.Dequee such that
(o==null ? e==null : o.equals(e))
(if such an element exists).
Returns true if this deque contained the specified element
(or equivalently, if this deque changed as a result of the call).removeLastOccurrence in interface Deque<E>o - element to be removed from this deque, if presenttrue if an element was removed as a result of this callCopyright © 2010–2017. All rights reserved.