public static class PriorityQueues.EmptyPriorityQueue extends AbstractPriorityQueue
This class may be useful to implement your own in case you subclass
PriorityQueue
.
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.
|
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.
|
Object |
first()
Returns the first element of the queue.
|
boolean |
isEmpty()
Checks whether the 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)
PriorityQueue
o
- the element to enqueue..public Object dequeue()
PriorityQueue
public boolean isEmpty()
PriorityQueue
isEmpty
in interface PriorityQueue
isEmpty
in class AbstractPriorityQueue
public int size()
PriorityQueue
public void clear()
PriorityQueue
public Object first()
PriorityQueue
public Object last()
PriorityQueue
last
in interface PriorityQueue
last
in class AbstractPriorityQueue
public void changed()
PriorityQueue
changed
in interface PriorityQueue
changed
in class AbstractPriorityQueue
public Comparator<?> comparator()
PriorityQueue
null
if it uses its elements' natural ordering.null
if it uses its elements' natural ordering.