Class ArrayDeque<T>

java.lang.Object
ArrayQueue<T>
ArrayDeque<T>
All Implemented Interfaces:
DequeInterface<T>, QueueInterface<T>

public class ArrayDeque<T> extends ArrayQueue<T> implements DequeInterface<T>
  • Constructor Details

    • ArrayDeque

      public ArrayDeque()
    • ArrayDeque

      public ArrayDeque(int initialCapacity)
  • Method Details

    • addToBack

      public void addToBack(T element)
      Description copied from interface: DequeInterface
      Adds a new entry to the back of this dequeue.
      Specified by:
      addToBack in interface DequeInterface<T>
      Parameters:
      element - element to be added to the dequeue
    • addToFront

      public void addToFront(T element)
      Description copied from interface: DequeInterface
      Adds a new entry to the front of this dequeue.
      Specified by:
      addToFront in interface DequeInterface<T>
      Parameters:
      element - element to be added to the dequeue
    • getFront

      public T getFront()
      Description copied from interface: QueueInterface
      Retrieves the element at the front of this queue. The size of the queue is not changed.
      Specified by:
      getFront in interface DequeInterface<T>
      Specified by:
      getFront in interface QueueInterface<T>
      Overrides:
      getFront in class ArrayQueue<T>
      Returns:
      The element at the front of the queue.
    • getBack

      public T getBack()
      Description copied from interface: DequeInterface
      Retrieves the element at the back of this dequeue. The size of the dequeue is not changed.
      Specified by:
      getBack in interface DequeInterface<T>
      Returns:
      The element at the back of the dequeue.
    • removeFront

      public T removeFront()
      Description copied from interface: DequeInterface
      Removes and returns the element at the front of the dequeue. The size of the dequeue is decreased by one.
      Specified by:
      removeFront in interface DequeInterface<T>
      Returns:
      The element at the front of the dequeue
    • removeBack

      public T removeBack()
      Description copied from interface: DequeInterface
      Removes and returns the element at the back of the dequeue. The size of the dequeue is decreased by one.
      Specified by:
      removeBack in interface DequeInterface<T>
      Returns:
      The element at the back of the dequeue