Package it.unimi.dsi.fastutil.ints
Interface IntPriorityQueue
- All Superinterfaces:
PriorityQueue<Integer>
- All Known Implementing Classes:
AbstractIntPriorityQueue
,IntArrayFIFOQueue
,IntArrayPriorityQueue
,IntHeapPriorityQueue
,IntPriorityQueues.SynchronizedPriorityQueue
public interface IntPriorityQueue extends PriorityQueue<Integer>
A type-specific
PriorityQueue
; provides some additional methods that
use polymorphism to avoid (un)boxing.
Additionally, this interface strengthens comparator()
.
-
Method Summary
Modifier and Type Method Description IntComparator
comparator()
Returns the comparator associated with this priority queue, or null if it uses its elements' natural ordering.default Integer
dequeue()
Deprecated.Please use the corresponding type-specific method instead.int
dequeueInt()
Dequeues the first element from the queue.void
enqueue(int x)
Enqueues a new element.default void
enqueue(Integer x)
Deprecated.Please use the corresponding type-specific method instead.default Integer
first()
Deprecated.Please use the corresponding type-specific method instead.int
firstInt()
Returns the first element of the queue.default Integer
last()
Deprecated.Please use the corresponding type-specific method instead.default int
lastInt()
Returns the last element of the queue, that is, the element the would be dequeued last (optional operation).
-
Method Details
-
enqueue
void enqueue(int x)Enqueues a new element.- Parameters:
x
- the element to enqueue.- See Also:
PriorityQueue.enqueue(Object)
-
dequeueInt
int dequeueInt()Dequeues the first element from the queue.- Returns:
- the dequeued element.
- Throws:
NoSuchElementException
- if the queue is empty.- See Also:
dequeue()
-
firstInt
int firstInt()Returns the first element of the queue.- Returns:
- the first element.
- Throws:
NoSuchElementException
- if the queue is empty.- See Also:
first()
-
lastInt
default int lastInt()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
.- Returns:
- the last element.
- Throws:
NoSuchElementException
- if the queue is empty.- See Also:
last()
-
comparator
IntComparator comparator()Returns the comparator associated with this priority queue, or null if it uses its elements' natural ordering.Note that this specification strengthens the one given in
PriorityQueue.comparator()
.- Specified by:
comparator
in interfacePriorityQueue<Integer>
- Returns:
- the comparator associated with this priority queue.
- See Also:
PriorityQueue.comparator()
-
enqueue
Deprecated.Please use the corresponding type-specific method instead.Enqueues a new element.This default implementation delegates to the corresponding type-specific method.
- Specified by:
enqueue
in interfacePriorityQueue<Integer>
- Parameters:
x
- the element to enqueue.
-
dequeue
Deprecated.Please use the corresponding type-specific method instead.Dequeues the first element from the queue.This default implementation delegates to the corresponding type-specific method.
- Specified by:
dequeue
in interfacePriorityQueue<Integer>
- Returns:
- the dequeued element.
-
first
Deprecated.Please use the corresponding type-specific method instead.Returns the first element of the queue.This default implementation delegates to the corresponding type-specific method.
- Specified by:
first
in interfacePriorityQueue<Integer>
- Returns:
- the first element.
-
last
Deprecated.Please use the corresponding type-specific method instead.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<Integer>
- Returns:
- the last element.
-