public class ShortHeapPriorityQueue extends AbstractShortPriorityQueue
| Constructor and Description |
|---|
ShortHeapPriorityQueue()
Default Constructor
|
ShortHeapPriorityQueue(int size)
Constructor with a Min Capacity
|
ShortHeapPriorityQueue(int size,
ShortComparator comp)
Constructor with a Min Capacity and custom Sorter
|
ShortHeapPriorityQueue(short[] array)
Constructor using a initial array
|
ShortHeapPriorityQueue(short[] array,
int size)
Constructor using a initial array
|
ShortHeapPriorityQueue(short[] array,
int size,
ShortComparator comp)
Constructor using a initial array and a custom sorter
|
ShortHeapPriorityQueue(short[] array,
ShortComparator comp)
Constructor using a initial array and a custom sorter
|
ShortHeapPriorityQueue(ShortCollection c)
Constructor using a Collection
|
ShortHeapPriorityQueue(ShortCollection c,
ShortComparator comp)
Constructor using a Collection and a custom sorter
|
ShortHeapPriorityQueue(ShortComparator comp)
Constructor using custom sorter
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
clears all elements within the PriorityQueue,
this does not resize the backing arrays
|
ShortComparator |
comparator() |
ShortHeapPriorityQueue |
copy()
A Function that does a shallow clone of the PriorityQueue itself.
|
int |
count(Short2BooleanFunction filter)
Helper function to reduce stream usage that allows to count the valid elements.
|
short |
dequeue()
Method to extract a element from the PriorityQueue
|
void |
enqueue(short e)
Method to insert a element into the PriorityQueue
|
short |
findFirst(Short2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for the first match.
|
<E> void |
forEach(E input,
ObjectShortConsumer<E> action)
Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
void |
forEach(ShortConsumer action)
A Type Specific foreach function that reduces (un)boxing
|
ShortIterator |
iterator()
Returns an iterator over elements of type
T. |
boolean |
matchesAll(Short2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for all matches.
|
boolean |
matchesAny(Short2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for any matches.
|
boolean |
matchesNone(Short2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for no matches.
|
void |
onChanged()
Allows to notify the Queue to be revalidate its data
|
short |
peek(int index)
Peeking function to see whats inside the queue.
|
short |
reduce(short identity,
ShortShortUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
short |
reduce(ShortShortUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
boolean |
removeFirst(short e)
Removes the first found element in the queue
|
boolean |
removeLast(short e)
Removes the last found element in the queue
|
int |
size() |
short[] |
toShortArray(short[] input)
A method to drop the contents of the Queue without clearing the queue
|
static ShortHeapPriorityQueue |
wrap(short[] array)
Wrapping method to help serialization
|
static ShortHeapPriorityQueue |
wrap(short[] array,
int size)
Wrapping method to help serialization
|
static ShortHeapPriorityQueue |
wrap(short[] array,
int size,
ShortComparator comp)
Wrapping method to help serialization, using a custom sorter
|
static ShortHeapPriorityQueue |
wrap(short[] array,
ShortComparator comp)
Wrapping method to help serialization, using a custom sorter
|
equals, hashCode, toStringenqueueAll, enqueueAll, enqueueAll, enqueueAll, first, isEmpty, synchronizeQueue, synchronizeQueue, toShortArrayarrayflatMap, asAsync, distinct, filter, flatMap, forEach, limit, map, peek, pour, pourAsList, pourAsSet, sorted, spliteratorpublic ShortHeapPriorityQueue()
public ShortHeapPriorityQueue(ShortComparator comp)
comp - Comparator to sort the Array. Can be nullpublic ShortHeapPriorityQueue(int size)
size - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public ShortHeapPriorityQueue(int size,
ShortComparator comp)
size - the initial capacity of the backing arraycomp - Comparator to sort the Array. Can be nulljava.lang.IllegalStateException - if the initial size is smaller 0public ShortHeapPriorityQueue(short[] array)
array - the Array that should be usedpublic ShortHeapPriorityQueue(short[] array,
int size)
array - the Array that should be usedsize - the amount of elements found within the arrayjava.lang.NegativeArraySizeException - if size is smaller then 0public ShortHeapPriorityQueue(short[] array,
ShortComparator comp)
array - the Array that should be usedcomp - Comparator to sort the Array. Can be nullpublic ShortHeapPriorityQueue(short[] array,
int size,
ShortComparator comp)
array - the Array that should be usedsize - the amount of elements found within the arraycomp - Comparator to sort the Array. Can be nulljava.lang.NegativeArraySizeException - if size is smaller then 0public ShortHeapPriorityQueue(ShortCollection c)
c - the Collection that should be usedpublic ShortHeapPriorityQueue(ShortCollection c, ShortComparator comp)
c - the Collection that should be usedcomp - Comparator to sort the Array. Can be nullpublic static ShortHeapPriorityQueue wrap(short[] array)
array - the array that should be usedpublic static ShortHeapPriorityQueue wrap(short[] array, int size)
array - the array that should be usedsize - the amount of elements within the arraypublic static ShortHeapPriorityQueue wrap(short[] array, ShortComparator comp)
array - the array that should be usedcomp - Comparator to sort the Array. Can be nullpublic static ShortHeapPriorityQueue wrap(short[] array, int size, ShortComparator comp)
array - the array that should be usedsize - the amount of elements within the arraycomp - Comparator to sort the Array. Can be nullpublic int size()
public void clear()
ShortPriorityQueuepublic ShortIterator iterator()
ShortIterableT.public void enqueue(short e)
ShortPriorityQueuee - the element that should be insertedpublic short dequeue()
ShortPriorityQueuepublic short peek(int index)
ShortPriorityQueueindex - of the element that is requested to be viewed.public boolean removeFirst(short e)
ShortPriorityQueuee - the element that should be removedpublic boolean removeLast(short e)
ShortPriorityQueuee - the element that should be removedpublic void forEach(ShortConsumer action)
ShortIterableaction - The action to be performed for each elementIterable.forEach(Consumer)public <E> void forEach(E input,
ObjectShortConsumer<E> action)
ShortIterableE - the generic type of the Objectinput - the object that should be includedaction - The action to be performed for each elementpublic boolean matchesAny(Short2BooleanFunction filter)
ShortIterablefilter - that should be appliedpublic boolean matchesNone(Short2BooleanFunction filter)
ShortIterablefilter - that should be appliedpublic boolean matchesAll(Short2BooleanFunction filter)
ShortIterablefilter - that should be appliedpublic short reduce(short identity,
ShortShortUnaryOperator operator)
ShortIterableidentity - the start valueoperator - the operation that should be appliedpublic short reduce(ShortShortUnaryOperator operator)
ShortIterableoperator - the operation that should be appliedpublic short findFirst(Short2BooleanFunction filter)
ShortIterablefilter - that should be appliedpublic int count(Short2BooleanFunction filter)
ShortIterablefilter - that should be appliedpublic void onChanged()
ShortPriorityQueuepublic ShortHeapPriorityQueue copy()
ShortPriorityQueuepublic ShortComparator comparator()
public short[] toShortArray(short[] input)
ShortPriorityQueueinput - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array