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 TypeMethodDescriptionvoidAdds a new entry to the this queue based on priority.voidAdds 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, isEmptyMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PriorityQueueInterface
clear, isEmptyMethods inherited from interface QueueInterface
dequeue, getFront
-
Constructor Details
-
LinkedPriorityQueue
public LinkedPriorityQueue()
-
-
Method Details
-
add
Description copied from interface:PriorityQueueInterfaceAdds a new entry to the this queue based on priority.- Specified by:
addin interfacePriorityQueueInterface<T extends Comparable<? super T>>- Parameters:
element- element to be added to the queue
-
enqueue
Description copied from interface:QueueInterfaceAdds a new entry to the back of this queue.- Specified by:
enqueuein interfaceQueueInterface<T extends Comparable<? super T>>- Overrides:
enqueuein classLinkedQueue<T extends Comparable<? super T>>- Parameters:
element- element to be added to the queue
-
remove
Description copied from interface:PriorityQueueInterfaceRemoves and returns the element in the queue that has the highest priority. The size of the queue is decreased by one.- Specified by:
removein interfacePriorityQueueInterface<T extends Comparable<? super T>>- Returns:
- The element in the queue with the highest priority
-
peek
Description copied from interface:PriorityQueueInterfaceRetrieves the element in the queue that has the highest priority. The size of the queue is not changed.- Specified by:
peekin interfacePriorityQueueInterface<T extends Comparable<? super T>>- Returns:
- The element in the queue with the highest priority
-