Package it.unimi.dsi.fastutil.chars
Class CharPriorityQueues.SynchronizedPriorityQueue
java.lang.Object
it.unimi.dsi.fastutil.chars.CharPriorityQueues.SynchronizedPriorityQueue
- All Implemented Interfaces:
CharPriorityQueue
,PriorityQueue<Character>
- Enclosing class:
CharPriorityQueues
public static class CharPriorityQueues.SynchronizedPriorityQueue
extends Object
implements CharPriorityQueue
A synchronized wrapper class for priority queues.
-
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.Returns the comparator associated with this priority queue, or null if it uses its elements' natural ordering.dequeue()
Deprecated.char
Dequeues the first element from the queue.void
enqueue
(char x) Enqueues a new element.void
Deprecated.boolean
first()
Deprecated.char
Returns the first element of the queue.int
hashCode()
boolean
isEmpty()
Checks whether this queue is empty.last()
Deprecated.char
lastChar()
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 Details
-
enqueue
public void enqueue(char x) Description copied from interface:CharPriorityQueue
Enqueues a new element.- Specified by:
enqueue
in interfaceCharPriorityQueue
- Parameters:
x
- the element to enqueue.- See Also:
-
dequeueChar
public char dequeueChar()Description copied from interface:CharPriorityQueue
Dequeues the first element from the queue.- Specified by:
dequeueChar
in interfaceCharPriorityQueue
- Returns:
- the dequeued element.
- See Also:
-
firstChar
public char firstChar()Description copied from interface:CharPriorityQueue
Returns the first element of the queue.- Specified by:
firstChar
in interfaceCharPriorityQueue
- Returns:
- the first element.
- See Also:
-
lastChar
public char lastChar()Description copied from interface:CharPriorityQueue
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:
lastChar
in interfaceCharPriorityQueue
- Returns:
- the last element.
- See Also:
-
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<Character>
- 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<Character>
- 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<Character>
-
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<Character>
-
comparator
Description copied from interface:CharPriorityQueue
Returns the comparator associated with this priority queue, or null if it uses its elements' natural ordering.- Specified by:
comparator
in interfaceCharPriorityQueue
- Specified by:
comparator
in interfacePriorityQueue<Character>
- Returns:
- the comparator associated with this priority queue.
- See Also:
-
enqueue
Deprecated.Description copied from interface:CharPriorityQueue
Enqueues a new element.This default implementation delegates to the corresponding type-specific method.
- Specified by:
enqueue
in interfaceCharPriorityQueue
- Specified by:
enqueue
in interfacePriorityQueue<Character>
- Parameters:
x
- the element to enqueue.
-
dequeue
Deprecated.Description copied from interface:CharPriorityQueue
Dequeues the first element from the queue.This default implementation delegates to the corresponding type-specific method.
- Specified by:
dequeue
in interfaceCharPriorityQueue
- Specified by:
dequeue
in interfacePriorityQueue<Character>
- Returns:
- the dequeued element.
-
first
Deprecated.Description copied from interface:CharPriorityQueue
Returns the first element of the queue.This default implementation delegates to the corresponding type-specific method.
- Specified by:
first
in interfaceCharPriorityQueue
- Specified by:
first
in interfacePriorityQueue<Character>
- Returns:
- the first element.
-
last
Deprecated.Description copied from interface:CharPriorityQueue
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 interfaceCharPriorityQueue
- Specified by:
last
in interfacePriorityQueue<Character>
- Returns:
- the last element.
-
hashCode
public int hashCode() -
equals
-