Class LinkedPriorityQueue<T extends Comparable<? super T>>

java.lang.Object
LinkedQueue<T>
LinkedPriorityQueue<T>
All Implemented Interfaces:
PriorityQueueInterface<T>, QueueInterface<T>

public final class LinkedPriorityQueue<T extends Comparable<? super T>> extends LinkedQueue<T> implements PriorityQueueInterface<T>
  • Constructor Details

    • LinkedPriorityQueue

      public LinkedPriorityQueue()
  • Method Details

    • add

      public void add(T element)
      Description copied from interface: PriorityQueueInterface
      Adds a new entry to the this queue based on priority.
      Specified by:
      add in interface PriorityQueueInterface<T extends Comparable<? super T>>
      Parameters:
      element - element to be added to the queue
    • 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 extends Comparable<? super T>>
      Overrides:
      enqueue in class LinkedQueue<T extends Comparable<? super T>>
      Parameters:
      element - element to be added to the queue
    • remove

      public T remove()
      Description copied from interface: PriorityQueueInterface
      Removes and returns the element in the queue that has the highest priority. The size of the queue is decreased by one.
      Specified by:
      remove in interface PriorityQueueInterface<T extends Comparable<? super T>>
      Returns:
      The element in the queue with the highest priority
    • peek

      public T peek()
      Description copied from interface: PriorityQueueInterface
      Retrieves the element in the queue that has the highest priority. The size of the queue is not changed.
      Specified by:
      peek in interface PriorityQueueInterface<T extends Comparable<? super T>>
      Returns:
      The element in the queue with the highest priority