Package com.google.common.collect
Class ForwardingDeque<E extends @Nullable Object>
- java.lang.Object
-
- com.google.common.collect.ForwardingObject
-
- com.google.common.collect.ForwardingCollection<E>
-
- com.google.common.collect.ForwardingQueue<E>
-
- com.google.common.collect.ForwardingDeque<E>
-
- All Implemented Interfaces:
Iterable<E>,Collection<E>,Deque<E>,Queue<E>
- Direct Known Subclasses:
ForwardingBlockingDeque,ForwardingBlockingDeque
@GwtIncompatible public abstract class ForwardingDeque<E extends @Nullable Object> extends ForwardingQueue<E> implements Deque<E>
A deque which forwards all its method calls to another deque. Subclasses should override one or more methods to modify the behavior of the backing deque as desired per the decorator pattern.Warning: The methods of
ForwardingDequeforward indiscriminately to the methods of the delegate. For example, overridingForwardingCollection.add(E)alone will not change the behavior ofForwardingQueue.offer(E)which can lead to unexpected behavior. In this case, you should overrideofferas well.defaultmethod warning: This class does not forward calls todefaultmethods. Instead, it inherits their default implementations. When those implementations invoke methods, they invoke methods on theForwardingDeque.- Since:
- 12.0
- Author:
- Kurt Alfred Kluever
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedForwardingDeque()Constructor for use by subclasses.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddFirst(E e)voidaddLast(E e)protected abstract Deque<E>delegate()Returns the backing delegate instance that methods are forwarded to.Iterator<E>descendingIterator()EgetFirst()EgetLast()booleanofferFirst(E e)booleanofferLast(E e)EpeekFirst()EpeekLast()EpollFirst()EpollLast()Epop()voidpush(E e)EremoveFirst()booleanremoveFirstOccurrence(Object o)EremoveLast()booleanremoveLastOccurrence(Object o)-
Methods inherited from class com.google.common.collect.ForwardingQueue
element, offer, peek, poll, remove, standardOffer, standardPeek, standardPoll
-
Methods inherited from class com.google.common.collect.ForwardingCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, standardAddAll, standardClear, standardContains, standardContainsAll, standardIsEmpty, standardRemove, standardRemoveAll, standardRetainAll, standardToArray, standardToArray, standardToString, toArray, toArray
-
Methods inherited from class com.google.common.collect.ForwardingObject
toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
-
-
-
Constructor Detail
-
ForwardingDeque
protected ForwardingDeque()
Constructor for use by subclasses.
-
-
Method Detail
-
delegate
protected abstract Deque<E> delegate()
Description copied from class:ForwardingObjectReturns the backing delegate instance that methods are forwarded to. Abstract subclasses generally override this method with an abstract method that has a more specific return type, such asForwardingSet.delegate(). Concrete subclasses override this method to supply the instance being decorated.- Specified by:
delegatein classForwardingQueue<E extends @Nullable Object>
-
descendingIterator
public Iterator<E> descendingIterator()
- Specified by:
descendingIteratorin interfaceDeque<E extends @Nullable Object>
-
offerFirst
@CanIgnoreReturnValue public boolean offerFirst(E e)
- Specified by:
offerFirstin interfaceDeque<E extends @Nullable Object>
-
offerLast
@CanIgnoreReturnValue public boolean offerLast(E e)
-
peekFirst
@CheckForNull public E peekFirst()
-
peekLast
@CheckForNull public E peekLast()
-
pollFirst
@CanIgnoreReturnValue @CheckForNull public E pollFirst()
-
pollLast
@CanIgnoreReturnValue @CheckForNull public E pollLast()
-
pop
@CanIgnoreReturnValue public E pop()
-
removeFirst
@CanIgnoreReturnValue public E removeFirst()
- Specified by:
removeFirstin interfaceDeque<E extends @Nullable Object>
-
removeLast
@CanIgnoreReturnValue public E removeLast()
- Specified by:
removeLastin interfaceDeque<E extends @Nullable Object>
-
removeFirstOccurrence
@CanIgnoreReturnValue public boolean removeFirstOccurrence(@CheckForNull Object o)
- Specified by:
removeFirstOccurrencein interfaceDeque<E extends @Nullable Object>
-
removeLastOccurrence
@CanIgnoreReturnValue public boolean removeLastOccurrence(@CheckForNull Object o)
- Specified by:
removeLastOccurrencein interfaceDeque<E extends @Nullable Object>
-
-