Package it.unimi.dsi.fastutil.ints
Class IntPriorityQueues.SynchronizedPriorityQueue
java.lang.Object
it.unimi.dsi.fastutil.ints.IntPriorityQueues.SynchronizedPriorityQueue
- All Implemented Interfaces:
IntPriorityQueue,PriorityQueue<Integer>
- Enclosing class:
- IntPriorityQueues
public static class IntPriorityQueues.SynchronizedPriorityQueue
extends Object
implements IntPriorityQueue
A synchronized wrapper class for priority queues.
-
Method Summary
Modifier and TypeMethodDescriptionvoidchanged()Notifies the queue that the first element has changed (optional operation).voidclear()Removes all elements from this queue.Returns the comparator associated with this priority queue, or null if it uses its elements' natural ordering.dequeue()Deprecated.intDequeues the first element from the queue.voidenqueue(int x) Enqueues a new element.voidDeprecated.booleanfirst()Deprecated.intfirstInt()Returns the first element of the queue.inthashCode()booleanisEmpty()Checks whether this queue is empty.last()Deprecated.intlastInt()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.
-
Method Details
-
enqueue
public void enqueue(int x) Description copied from interface:IntPriorityQueueEnqueues a new element.- Specified by:
enqueuein interfaceIntPriorityQueue- Parameters:
x- the element to enqueue.- See Also:
-
dequeueInt
public int dequeueInt()Description copied from interface:IntPriorityQueueDequeues the first element from the queue.- Specified by:
dequeueIntin interfaceIntPriorityQueue- Returns:
- the dequeued element.
- See Also:
-
firstInt
public int firstInt()Description copied from interface:IntPriorityQueueReturns the first element of the queue.- Specified by:
firstIntin interfaceIntPriorityQueue- Returns:
- the first element.
- See Also:
-
lastInt
public int lastInt()Description copied from interface:IntPriorityQueueReturns 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:
lastIntin interfaceIntPriorityQueue- Returns:
- the last element.
- See Also:
-
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<Integer>- 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<Integer>- 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<Integer>
-
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<Integer>
-
comparator
Description copied from interface:IntPriorityQueueReturns the comparator associated with this priority queue, or null if it uses its elements' natural ordering.- Specified by:
comparatorin interfaceIntPriorityQueue- Specified by:
comparatorin interfacePriorityQueue<Integer>- Returns:
- the comparator associated with this priority queue.
- See Also:
-
enqueue
Deprecated.Description copied from interface:IntPriorityQueueEnqueues a new element.This default implementation delegates to the corresponding type-specific method.
- Specified by:
enqueuein interfaceIntPriorityQueue- Specified by:
enqueuein interfacePriorityQueue<Integer>- Parameters:
x- the element to enqueue.
-
dequeue
Deprecated.Description copied from interface:IntPriorityQueueDequeues the first element from the queue.This default implementation delegates to the corresponding type-specific method.
- Specified by:
dequeuein interfaceIntPriorityQueue- Specified by:
dequeuein interfacePriorityQueue<Integer>- Returns:
- the dequeued element.
-
first
Deprecated.Description copied from interface:IntPriorityQueueReturns the first element of the queue.This default implementation delegates to the corresponding type-specific method.
- Specified by:
firstin interfaceIntPriorityQueue- Specified by:
firstin interfacePriorityQueue<Integer>- Returns:
- the first element.
-
last
Deprecated.Description copied from interface:IntPriorityQueueReturns the last element of the queue, that is, the element the would be dequeued last (optional operation).This default implementation just throws an
UnsupportedOperationException.This default implementation delegates to the corresponding type-specific method.
- Specified by:
lastin interfaceIntPriorityQueue- Specified by:
lastin interfacePriorityQueue<Integer>- Returns:
- the last element.
-
hashCode
public int hashCode() -
equals
-