Class 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, 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.

    Since:
    12.0
    • Constructor Detail

      • ForwardingDeque

        protected ForwardingDeque()
        Constructor for use by subclasses.
    • Method Detail

      • delegate

        protected abstract Deque<E> delegate()
        Description copied from class: ForwardingObject
        Returns 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 as ForwardingSet.delegate(). Concrete subclasses override this method to supply the instance being decorated.
      • addFirst

        public void addFirst(E e)
      • addLast

        public void addLast(E e)
      • descendingIterator

        public Iterator<E> descendingIterator()
      • getFirst

        public E getFirst()
      • getLast

        public E getLast()
      • offerFirst

        public boolean offerFirst(E e)
      • offerLast

        public boolean offerLast(E e)
      • peekFirst

        public E peekFirst()
      • peekLast

        public E peekLast()
      • pollFirst

        public E pollFirst()
      • pollLast

        public E pollLast()
      • pop

        public E pop()
      • push

        public void push(E e)
      • removeFirst

        public E removeFirst()
      • removeLast

        public E removeLast()
      • removeFirstOccurrence

        public boolean removeFirstOccurrence(Object o)
      • removeLastOccurrence

        public boolean removeLastOccurrence(Object o)