Package it.unimi.dsi.fastutil.shorts
Class ShortPriorityQueues.SynchronizedPriorityQueue
- java.lang.Object
-
- it.unimi.dsi.fastutil.shorts.ShortPriorityQueues.SynchronizedPriorityQueue
-
- All Implemented Interfaces:
PriorityQueue<java.lang.Short>
,ShortPriorityQueue
- Enclosing class:
- ShortPriorityQueues
public static class ShortPriorityQueues.SynchronizedPriorityQueue extends java.lang.Object implements ShortPriorityQueue
A synchronized wrapper class for priority queues.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
changed()
Notifies the queue that the first element has changed (optional operation).void
clear()
Removes all elements from this queue.ShortComparator
comparator()
Returns the comparator associated with this priority queue, or null if it uses its elements' natural ordering.java.lang.Short
dequeue()
Deprecated.short
dequeueShort()
Dequeues the first element from the queue.void
enqueue(short x)
Enqueues a new element.void
enqueue(java.lang.Short x)
Deprecated.boolean
equals(java.lang.Object o)
java.lang.Short
first()
Deprecated.short
firstShort()
Returns the first element of the queue.int
hashCode()
boolean
isEmpty()
Checks whether this queue is empty.java.lang.Short
last()
Deprecated.short
lastShort()
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.
-
-
-
Method Detail
-
enqueue
public void enqueue(short x)
Description copied from interface:ShortPriorityQueue
Enqueues a new element.- Specified by:
enqueue
in interfaceShortPriorityQueue
- Parameters:
x
- the element to enqueue.- See Also:
PriorityQueue.enqueue(Object)
-
dequeueShort
public short dequeueShort()
Description copied from interface:ShortPriorityQueue
Dequeues the first element from the queue.- Specified by:
dequeueShort
in interfaceShortPriorityQueue
- Returns:
- the dequeued element.
- See Also:
ShortPriorityQueue.dequeue()
-
firstShort
public short firstShort()
Description copied from interface:ShortPriorityQueue
Returns the first element of the queue.- Specified by:
firstShort
in interfaceShortPriorityQueue
- Returns:
- the first element.
- See Also:
ShortPriorityQueue.first()
-
lastShort
public short lastShort()
Description copied from interface:ShortPriorityQueue
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:
lastShort
in interfaceShortPriorityQueue
- Returns:
- the last element.
- See Also:
ShortPriorityQueue.last()
-
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<java.lang.Short>
- 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<java.lang.Short>
- 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<java.lang.Short>
-
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<java.lang.Short>
-
comparator
public ShortComparator comparator()
Description copied from interface:ShortPriorityQueue
Returns the comparator associated with this priority queue, or null if it uses its elements' natural ordering.- Specified by:
comparator
in interfacePriorityQueue<java.lang.Short>
- Specified by:
comparator
in interfaceShortPriorityQueue
- Returns:
- the comparator associated with this priority queue.
- See Also:
PriorityQueue.comparator()
-
enqueue
@Deprecated public void enqueue(java.lang.Short x)
Deprecated.Description copied from interface:ShortPriorityQueue
Enqueues a new element.This default implementation delegates to the corresponding type-specific method.
- Specified by:
enqueue
in interfacePriorityQueue<java.lang.Short>
- Specified by:
enqueue
in interfaceShortPriorityQueue
- Parameters:
x
- the element to enqueue.
-
dequeue
@Deprecated public java.lang.Short dequeue()
Deprecated.Description copied from interface:ShortPriorityQueue
Dequeues the first element from the queue.This default implementation delegates to the corresponding type-specific method.
- Specified by:
dequeue
in interfacePriorityQueue<java.lang.Short>
- Specified by:
dequeue
in interfaceShortPriorityQueue
- Returns:
- the dequeued element.
-
first
@Deprecated public java.lang.Short first()
Deprecated.Description copied from interface:ShortPriorityQueue
Returns the first element of the queue.This default implementation delegates to the corresponding type-specific method.
- Specified by:
first
in interfacePriorityQueue<java.lang.Short>
- Specified by:
first
in interfaceShortPriorityQueue
- Returns:
- the first element.
-
last
@Deprecated public java.lang.Short last()
Deprecated.Description copied from interface:ShortPriorityQueue
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
.This default implementation delegates to the corresponding type-specific method.
- Specified by:
last
in interfacePriorityQueue<java.lang.Short>
- Specified by:
last
in interfaceShortPriorityQueue
- Returns:
- the last element.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
-