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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static longserialVersionUID
-
Method Summary
Modifier and Type Method Description voidchanged()Notifies the queue that the first element has changed (optional operation).voidclear()Removes all elements from this queue.Comparator<? super K>comparator()Returns the comparator associated with this queue, ornullif it uses its elements' natural ordering.Kdequeue()Dequeues the first element from the queue.voidenqueue(K x)Enqueues a new element.booleanequals(Object o)Kfirst()Returns the first element of the queue.inthashCode()booleanisEmpty()Checks whether this queue is empty.Klast()Returns the last element of the queue, that is, the element the would be dequeued last (optional operation).intsize()Returns the number of elements in this queue.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
public static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
enqueue
public void enqueue(K x)
Description copied from interface:PriorityQueueEnqueues a new element.- Specified by:
enqueuein interfacePriorityQueue<K>- Parameters:
x- the element to enqueue.
-
dequeue
public K dequeue()
Description copied from interface:PriorityQueueDequeues the first element from the queue.- Specified by:
dequeuein interfacePriorityQueue<K>- Returns:
- the dequeued element.
-
first
public K first()
Description copied from interface:PriorityQueueReturns the first element of the queue.- Specified by:
firstin interfacePriorityQueue<K>- Returns:
- the first element.
-
last
public K last()
Description copied from interface:PriorityQueueReturns 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:
lastin interfacePriorityQueue<K>- Returns:
- the last element.
-
isEmpty
public boolean isEmpty()
Description copied from interface:PriorityQueueChecks whether this queue is empty.This default implementation checks whether
PriorityQueue.size()is zero.- Specified by:
isEmptyin interfacePriorityQueue<K>- Returns:
- true if this queue is empty.
-
size
public int size()
Description copied from interface:PriorityQueueReturns the number of elements in this queue.- Specified by:
sizein interfacePriorityQueue<K>- Returns:
- the number of elements in this queue.
-
clear
public void clear()
Description copied from interface:PriorityQueueRemoves all elements from this queue.- Specified by:
clearin interfacePriorityQueue<K>
-
changed
public void changed()
Description copied from interface:PriorityQueueNotifies the queue that the first element has changed (optional operation).This default implementation just throws an
UnsupportedOperationException.- Specified by:
changedin interfacePriorityQueue<K>
-
comparator
public Comparator<? super K> comparator()
Description copied from interface:PriorityQueueReturns the comparator associated with this queue, ornullif it uses its elements' natural ordering.- Specified by:
comparatorin interfacePriorityQueue<K>- Returns:
- the comparator associated with this sorted set, or
nullif it uses its elements' natural ordering.
-
-