Class LinkedDeque<T>

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

public class LinkedDeque<T> extends Object implements DequeInterface<T>
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • 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.
    Removes and returns the element at the front of the queue.
    void
    enqueue(T element)
    Adds a new entry to the back of this queue.
    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 class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LinkedDeque

      public LinkedDeque()
  • 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
    • 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.
    • getFront

      public T getFront()
      Description copied from interface: DequeInterface
      Retrieves the element at the front of this dequeue. The size of the dequeue is not changed.
      Specified by:
      getFront in interface DequeInterface<T>
      Specified by:
      getFront in interface QueueInterface<T>
      Returns:
      The element at the front 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
    • clear

      public void clear()
      Description copied from interface: DequeInterface
      Removes all entries from the dequeue.
      Specified by:
      clear in interface DequeInterface<T>
      Specified by:
      clear in interface QueueInterface<T>
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: DequeInterface
      Determines if there are any elements in the dequeue.
      Specified by:
      isEmpty in interface DequeInterface<T>
      Specified by:
      isEmpty in interface QueueInterface<T>
      Returns:
      True if the dequeue is empty.
    • enqueue

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

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