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