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.
| 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.
|
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.
|
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, returning
true upon success and 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, waitprotected 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.DequeDeque.offerFirst(E).public void addLast(E e)
java.util.DequeDeque.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.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 addpublic 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.Dequepublic E peekLast()
java.util.Dequepublic E pollFirst()
java.util.Dequepublic E pollLast()
java.util.Dequepublic E pop()
java.util.DequeThis method is equivalent to Deque.removeFirst().
public void push(E e)
java.util.DequeThis method is equivalent to Deque.addFirst(E).
public E removeFirst()
java.util.DequepollFirst only in that it throws an
exception if this deque is empty.removeFirst in interface Deque<E>public E removeLast()
java.util.DequepollLast only in that it throws an
exception if this deque is empty.removeLast in interface Deque<E>public boolean removeFirstOccurrence(Object o)
java.util.DequeremoveFirstOccurrence in interface Deque<E>o - element to be removed from this deque, if presentpublic boolean removeLastOccurrence(Object o)
java.util.DequeremoveLastOccurrence in interface Deque<E>o - element to be removed from this deque, if presentCopyright © 2010-2013. All Rights Reserved.