Interface PriorityQueueInterface<T extends Comparable<? super T>>

All Superinterfaces:
QueueInterface<T>
All Known Implementing Classes:
LinkedPriorityQueue

public interface PriorityQueueInterface<T extends Comparable<? super T>> extends QueueInterface<T>
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(T element)
    Adds a new entry to the this queue based on priority.
    void
    Removes all entries from the queue.
    boolean
    Determines if there are any elements in the queue.
    Retrieves the element in the queue that has the highest priority.
    Removes and returns the element in the queue that has the highest priority.

    Methods inherited from interface QueueInterface

    dequeue, enqueue, getFront
  • Method Details

    • add

      void add(T element)
      Adds a new entry to the this queue based on priority.
      Parameters:
      element - element to be added to the queue
    • remove

      T remove()
      Removes and returns the element in the queue that has the highest priority. The size of the queue is decreased by one.
      Returns:
      The element in the queue with the highest priority
      Throws:
      EmptyQueueException - if the queue is empty when the method is invoked
    • peek

      T peek()
      Retrieves the element in the queue that has the highest priority. The size of the queue is not changed.
      Returns:
      The element in the queue with the highest priority
      Throws:
      EmptyQueueException - if the queue is empty when the method is invoked
    • isEmpty

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

      void clear()
      Removes all entries from the queue.
      Specified by:
      clear in interface QueueInterface<T extends Comparable<? super T>>