Package it.unimi.dsi.fastutil.shorts
Class ShortPriorityQueues.SynchronizedPriorityQueue
java.lang.Object
it.unimi.dsi.fastutil.shorts.ShortPriorityQueues.SynchronizedPriorityQueue
- All Implemented Interfaces:
PriorityQueue<Short>,ShortPriorityQueue
- Enclosing class:
ShortPriorityQueues
public static class ShortPriorityQueues.SynchronizedPriorityQueue
extends Object
implements ShortPriorityQueue
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.shortDequeues the first element from the queue.voidenqueue(short x) Enqueues a new element.voidDeprecated.booleanfirst()Deprecated.shortReturns the first element of the queue.inthashCode()booleanisEmpty()Checks whether this queue is empty.last()Deprecated.shortReturns 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(short x) Description copied from interface:ShortPriorityQueueEnqueues a new element.- Specified by:
enqueuein interfaceShortPriorityQueue- Parameters:
x- the element to enqueue.- See Also:
-
dequeueShort
public short dequeueShort()Description copied from interface:ShortPriorityQueueDequeues the first element from the queue.- Specified by:
dequeueShortin interfaceShortPriorityQueue- Returns:
- the dequeued element.
- See Also:
-
firstShort
public short firstShort()Description copied from interface:ShortPriorityQueueReturns the first element of the queue.- Specified by:
firstShortin interfaceShortPriorityQueue- Returns:
- the first element.
- See Also:
-
lastShort
public short lastShort()Description copied from interface:ShortPriorityQueueReturns 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:
lastShortin interfaceShortPriorityQueue- 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<Short>- 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<Short>- 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<Short>
-
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<Short>
-
comparator
Description copied from interface:ShortPriorityQueueReturns the comparator associated with this priority queue, or null if it uses its elements' natural ordering.- Specified by:
comparatorin interfacePriorityQueue<Short>- Specified by:
comparatorin interfaceShortPriorityQueue- Returns:
- the comparator associated with this priority queue.
- See Also:
-
enqueue
Deprecated.Description copied from interface:ShortPriorityQueueEnqueues a new element.This default implementation delegates to the corresponding type-specific method.
- Specified by:
enqueuein interfacePriorityQueue<Short>- Specified by:
enqueuein interfaceShortPriorityQueue- Parameters:
x- the element to enqueue.
-
dequeue
Deprecated.Description copied from interface:ShortPriorityQueueDequeues the first element from the queue.This default implementation delegates to the corresponding type-specific method.
- Specified by:
dequeuein interfacePriorityQueue<Short>- Specified by:
dequeuein interfaceShortPriorityQueue- Returns:
- the dequeued element.
-
first
Deprecated.Description copied from interface:ShortPriorityQueueReturns the first element of the queue.This default implementation delegates to the corresponding type-specific method.
- Specified by:
firstin interfacePriorityQueue<Short>- Specified by:
firstin interfaceShortPriorityQueue- Returns:
- the first element.
-
last
Deprecated.Description copied from interface:ShortPriorityQueueReturns 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 interfacePriorityQueue<Short>- Specified by:
lastin interfaceShortPriorityQueue- Returns:
- the last element.
-
hashCode
public int hashCode() -
equals
-