public static class PriorityQueues.EmptyPriorityQueue extends Object implements PriorityQueue, Serializable
This class may be useful to implement your own in case you subclass
PriorityQueue.
| Modifier | Constructor and Description |
|---|---|
protected |
EmptyPriorityQueue() |
| Modifier and Type | Method and Description |
|---|---|
void |
changed()
Notifies the queue that the first element has changed (optional operation).
|
void |
clear()
Removes all elements from this queue.
|
Object |
clone() |
Comparator<?> |
comparator()
Returns the comparator associated with this queue, or
null if it uses its elements' natural ordering. |
Object |
dequeue()
Dequeues the first element from the queue.
|
void |
enqueue(Object o)
Enqueues a new element.
|
boolean |
equals(Object o) |
Object |
first()
Returns the first element of the queue.
|
int |
hashCode() |
boolean |
isEmpty()
Checks whether this queue is empty.
|
Object |
last()
Returns the last element of the queue, that is, the element the would be dequeued last (optional operation).
|
int |
size()
Returns the number of elements in this queue.
|
public void enqueue(Object o)
PriorityQueueenqueue in interface PriorityQueueo - the element to enqueue.public Object dequeue()
PriorityQueuedequeue in interface PriorityQueuepublic boolean isEmpty()
PriorityQueueThis default implementation checks whether PriorityQueue.size() is zero.
isEmpty in interface PriorityQueuepublic int size()
PriorityQueuesize in interface PriorityQueuepublic void clear()
PriorityQueueclear in interface PriorityQueuepublic Object first()
PriorityQueuefirst in interface PriorityQueuepublic Object last()
PriorityQueueThis default implementation just throws an UnsupportedOperationException.
last in interface PriorityQueuepublic void changed()
PriorityQueueThis default implementation just throws an UnsupportedOperationException.
changed in interface PriorityQueuepublic Comparator<?> comparator()
PriorityQueuenull if it uses its elements' natural ordering.comparator in interface PriorityQueuenull if it uses its elements' natural ordering.Copyright © 2020. All rights reserved.