Package com.google.common.collect
Class ForwardingDeque<E>
- 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
public abstract class ForwardingDeque<E> 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
ForwardingDeque
forward 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 overrideoffer
as well.- Since:
- 12.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFirst(E e)
void
addLast(E e)
Iterator<E>
descendingIterator()
E
getFirst()
E
getLast()
boolean
offerFirst(E e)
boolean
offerLast(E e)
E
peekFirst()
E
peekLast()
E
pollFirst()
E
pollLast()
E
pop()
void
push(E e)
E
removeFirst()
boolean
removeFirstOccurrence(Object o)
E
removeLast()
boolean
removeLastOccurrence(Object o)
-
Methods inherited from class com.google.common.collect.ForwardingQueue
element, offer, peek, poll, remove
-
Methods inherited from class com.google.common.collect.ForwardingCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
-
Methods inherited from class com.google.common.collect.ForwardingObject
toString
-
Methods inherited from class java.lang.Object
equals, 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
-
-
-
-
Method Detail
-
descendingIterator
public Iterator<E> descendingIterator()
- Specified by:
descendingIterator
in interfaceDeque<E>
-
offerFirst
public boolean offerFirst(E e)
- Specified by:
offerFirst
in interfaceDeque<E>
-
removeFirst
public E removeFirst()
- Specified by:
removeFirst
in interfaceDeque<E>
-
removeLast
public E removeLast()
- Specified by:
removeLast
in interfaceDeque<E>
-
removeFirstOccurrence
public boolean removeFirstOccurrence(Object o)
- Specified by:
removeFirstOccurrence
in interfaceDeque<E>
-
removeLastOccurrence
public boolean removeLastOccurrence(Object o)
- Specified by:
removeLastOccurrence
in interfaceDeque<E>
-
-