Package org.apache.flink.runtime.state
Interface InternalPriorityQueue<T>
-
- Type Parameters:
T
- type of elements in the ordered set.
- All Known Subinterfaces:
KeyGroupedInternalPriorityQueue<T>
- All Known Implementing Classes:
AbstractHeapPriorityQueue
,ChangelogKeyGroupedPriorityQueue
,ForStDBCachingPriorityQueueSet
,HeapPriorityQueue
,HeapPriorityQueueSet
,KeyGroupPartitionedPriorityQueue
,RocksDBCachingPriorityQueueSet
@Internal public interface InternalPriorityQueue<T>
Interface for collection that gives in order access to elements w.r.t their priority.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
add(T toAdd)
Adds the given element to the set, if it is not already contained.void
addAll(Collection<? extends T> toAdd)
Adds all the given elements to the set.boolean
isEmpty()
Check if the set contains any elements.CloseableIterator<T>
iterator()
Iterator over all elements, no order guaranteed.T
peek()
Retrieves, but does not remove, the element (w.r.t. order) of this set, or returnsnull
if this set is empty.T
poll()
Retrieves and removes the first element (w.r.t. the order) of this set, or returnsnull
if this set is empty.boolean
remove(T toRemove)
Removes the given element from the set, if is contained in the set.int
size()
Returns the number of elements in this set.
-
-
-
Method Detail
-
poll
@Nullable T poll()
Retrieves and removes the first element (w.r.t. the order) of this set, or returnsnull
if this set is empty.NOTE: Correct key (i.e. the key of the polled element) must be set on KeyContext before calling this method.
- Returns:
- the first element of this ordered set, or
null
if this set is empty.
-
peek
@Nullable T peek()
Retrieves, but does not remove, the element (w.r.t. order) of this set, or returnsnull
if this set is empty.- Returns:
- the first element (w.r.t. order) of this ordered set, or
null
if this set is empty.
-
add
boolean add(@Nonnull T toAdd)
Adds the given element to the set, if it is not already contained.- Parameters:
toAdd
- the element to add to the set.- Returns:
true
if the operation changed the head element or if it is unclear if the head element changed. Only returnsfalse
if the head element was not changed by this operation.
-
remove
boolean remove(@Nonnull T toRemove)
Removes the given element from the set, if is contained in the set.NOTE: Correct key (i.e. the key of the polled element) must be set on KeyContext before calling this method.
- Parameters:
toRemove
- the element to remove.- Returns:
true
if the operation changed the head element or if it is unclear if the head element changed. Only returnsfalse
if the head element was not changed by this operation.
-
isEmpty
boolean isEmpty()
Check if the set contains any elements.- Returns:
- true if the set is empty, i.e. no element is contained.
-
size
@Nonnegative int size()
Returns the number of elements in this set.- Returns:
- the number of elements in this set.
-
addAll
void addAll(@Nullable Collection<? extends T> toAdd)
Adds all the given elements to the set.
-
iterator
@Nonnull CloseableIterator<T> iterator()
Iterator over all elements, no order guaranteed. Iterator must be closed after usage.
-
-