Interface DequeInterface<T>

All Superinterfaces:
QueueInterface<T>
All Known Implementing Classes:
ArrayDeque, LinkedDeque

public interface DequeInterface<T> extends QueueInterface<T>
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addToBack(T element)
    Adds a new entry to the back of this dequeue.
    void
    addToFront(T element)
    Adds a new entry to the front of this dequeue.
    void
    Removes all entries from the dequeue.
    Retrieves the element at the back of this dequeue.
    Retrieves the element at the front of this dequeue.
    boolean
    Determines if there are any elements in the dequeue.
    Removes and returns the element at the back of the dequeue.
    Removes and returns the element at the front of the dequeue.

    Methods inherited from interface QueueInterface

    dequeue, enqueue
  • Method Details

    • addToFront

      void addToFront(T element)
      Adds a new entry to the front of this dequeue.
      Parameters:
      element - element to be added to the dequeue
    • addToBack

      void addToBack(T element)
      Adds a new entry to the back of this dequeue.
      Parameters:
      element - element to be added to the dequeue
    • removeFront

      T removeFront()
      Removes and returns the element at the front of the dequeue. The size of the dequeue is decreased by one.
      Returns:
      The element at the front of the dequeue
      Throws:
      EmptyQueueException - if the dequeue is empty when the method is invoked
    • removeBack

      T removeBack()
      Removes and returns the element at the back of the dequeue. The size of the dequeue is decreased by one.
      Returns:
      The element at the back of the dequeue
      Throws:
      EmptyQueueException - if the dequeue is empty when the method is invoked
    • getFront

      T getFront()
      Retrieves the element at the front of this dequeue. The size of the dequeue is not changed.
      Specified by:
      getFront in interface QueueInterface<T>
      Returns:
      The element at the front of the dequeue.
      Throws:
      EmptyQueueException - if the dequeue is empty when the method is invoked
    • getBack

      T getBack()
      Retrieves the element at the back of this dequeue. The size of the dequeue is not changed.
      Returns:
      The element at the back of the dequeue.
      Throws:
      EmptyQueueException - if the dequeue is empty when the method is invoked
    • isEmpty

      boolean isEmpty()
      Determines if there are any elements in the dequeue.
      Specified by:
      isEmpty in interface QueueInterface<T>
      Returns:
      True if the dequeue is empty.
    • clear

      void clear()
      Removes all entries from the dequeue.
      Specified by:
      clear in interface QueueInterface<T>