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>
-
Nested Class Summary
Nested classes/interfaces inherited from class LinkedQueue
LinkedQueue.Node
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new entry to the this queue based on priority.void
Adds a new entry to the back of this queue.peek()
Retrieves the element in the queue that has the highest priority.remove()
Removes and returns the element in the queue that has the highest priority.Methods inherited from class LinkedQueue
clear, dequeue, getFront, isEmpty
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface PriorityQueueInterface
clear, isEmpty
Methods inherited from interface QueueInterface
dequeue, getFront
-
Constructor Details
-
LinkedPriorityQueue
public LinkedPriorityQueue()
-
-
Method Details
-
add
Description copied from interface:PriorityQueueInterface
Adds a new entry to the this queue based on priority.- Specified by:
add
in interfacePriorityQueueInterface<T extends Comparable<? super T>>
- Parameters:
element
- element to be added to the queue
-
enqueue
Description copied from interface:QueueInterface
Adds a new entry to the back of this queue.- Specified by:
enqueue
in interfaceQueueInterface<T extends Comparable<? super T>>
- Overrides:
enqueue
in classLinkedQueue<T extends Comparable<? super T>>
- Parameters:
element
- element to be added to the queue
-
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 interfacePriorityQueueInterface<T extends Comparable<? super T>>
- Returns:
- The element in the queue with the highest priority
-
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 interfacePriorityQueueInterface<T extends Comparable<? super T>>
- Returns:
- The element in the queue with the highest priority
-