Package it.unimi.dsi.fastutil
Class PriorityQueues.SynchronizedPriorityQueue<K>
java.lang.Object
it.unimi.dsi.fastutil.PriorityQueues.SynchronizedPriorityQueue<K>
- All Implemented Interfaces:
PriorityQueue<K>
,Serializable
- Enclosing class:
PriorityQueues
public static class PriorityQueues.SynchronizedPriorityQueue<K>
extends Object
implements PriorityQueue<K>, Serializable
A synchronized wrapper class for priority queues.
- See Also:
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
changed()
Notifies the queue that the first element has changed (optional operation).void
clear()
Removes all elements from this queue.Comparator
<? super K> Returns the comparator associated with this queue, ornull
if it uses its elements' natural ordering.dequeue()
Dequeues the first element from the queue.void
Enqueues a new element.boolean
first()
Returns the first element of the queue.int
hashCode()
boolean
isEmpty()
Checks whether this queue is empty.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.toString()
-
Field Details
-
serialVersionUID
public static final long serialVersionUID- See Also:
-
-
Method Details
-
enqueue
Description copied from interface:PriorityQueue
Enqueues a new element.- Specified by:
enqueue
in interfacePriorityQueue<K>
- Parameters:
x
- the element to enqueue.
-
dequeue
Description copied from interface:PriorityQueue
Dequeues the first element from the queue.- Specified by:
dequeue
in interfacePriorityQueue<K>
- Returns:
- the dequeued element.
-
first
Description copied from interface:PriorityQueue
Returns the first element of the queue.- Specified by:
first
in interfacePriorityQueue<K>
- Returns:
- the first element.
-
last
Description copied from interface:PriorityQueue
Returns the last element of the queue, that is, the element the would be dequeued last (optional operation).This default implementation just throws an
UnsupportedOperationException
.- Specified by:
last
in interfacePriorityQueue<K>
- Returns:
- the last element.
-
isEmpty
public boolean isEmpty()Description copied from interface:PriorityQueue
Checks whether this queue is empty.This default implementation checks whether
PriorityQueue.size()
is zero.- Specified by:
isEmpty
in interfacePriorityQueue<K>
- Returns:
- true if this queue is empty.
-
size
public int size()Description copied from interface:PriorityQueue
Returns the number of elements in this queue.- Specified by:
size
in interfacePriorityQueue<K>
- Returns:
- the number of elements in this queue.
-
clear
public void clear()Description copied from interface:PriorityQueue
Removes all elements from this queue.- Specified by:
clear
in interfacePriorityQueue<K>
-
changed
public void changed()Description copied from interface:PriorityQueue
Notifies the queue that the first element has changed (optional operation).This default implementation just throws an
UnsupportedOperationException
.- Specified by:
changed
in interfacePriorityQueue<K>
-
comparator
Description copied from interface:PriorityQueue
Returns the comparator associated with this queue, ornull
if it uses its elements' natural ordering.- Specified by:
comparator
in interfacePriorityQueue<K>
- Returns:
- the comparator associated with this sorted set, or
null
if it uses its elements' natural ordering.
-
toString
-
hashCode
public int hashCode() -
equals
-