Interface QueueInterface<T>

All Known Subinterfaces:
DequeInterface<T>, PriorityQueueInterface<T>
All Known Implementing Classes:
ArrayDeque, ArrayQueue, CircularLinkedQueue, LinkedDeque, LinkedPriorityQueue, LinkedQueue

public interface QueueInterface<T>
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Removes all entries from the queue.
    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 front of this queue.
    boolean
    Determines if there are any elements in the queue.
  • Method Details

    • enqueue

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

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

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

      boolean isEmpty()
      Determines if there are any elements in the queue.
      Returns:
      True if the queue is empty.
    • clear

      void clear()
      Removes all entries from the queue.