public static class PriorityQueues.EmptyPriorityQueue extends java.lang.Object implements PriorityQueue, java.io.Serializable
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.
|
java.lang.Object |
clone() |
java.util.Comparator<?> |
comparator()
Returns the comparator associated with this queue, or
null if it uses its elements' natural ordering. |
java.lang.Object |
dequeue()
Dequeues the first element from the queue.
|
void |
enqueue(java.lang.Object o)
Enqueues a new element.
|
boolean |
equals(java.lang.Object o) |
java.lang.Object |
first()
Returns the first element of the queue.
|
int |
hashCode() |
boolean |
isEmpty()
Checks whether this queue is empty.
|
java.lang.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(java.lang.Object o)
PriorityQueue
enqueue
in interface PriorityQueue
o
- the element to enqueue.public java.lang.Object dequeue()
PriorityQueue
dequeue
in interface PriorityQueue
public boolean isEmpty()
PriorityQueue
This default implementation checks whether PriorityQueue.size()
is zero.
isEmpty
in interface PriorityQueue
public int size()
PriorityQueue
size
in interface PriorityQueue
public void clear()
PriorityQueue
clear
in interface PriorityQueue
public java.lang.Object first()
PriorityQueue
first
in interface PriorityQueue
public java.lang.Object last()
PriorityQueue
This default implementation just throws an UnsupportedOperationException
.
last
in interface PriorityQueue
public void changed()
PriorityQueue
This default implementation just throws an UnsupportedOperationException
.
changed
in interface PriorityQueue
public java.util.Comparator<?> comparator()
PriorityQueue
null
if it uses its elements' natural ordering.comparator
in interface PriorityQueue
null
if it uses its elements' natural ordering.public java.lang.Object clone()
clone
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object