-
Method Summary
void
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.
-
Method Details
-
add
Adds a new entry to the this queue based on priority.
- Parameters:
element
- element to be added to the queue
-
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
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.
-