public class IntArrayPriorityQueue extends AbstractIntPriorityQueue
List.indexOf(Object) search.
It is highly suggested to use HeapPriorityQueue otherwise, unless you know why you need this specific implementation| Constructor and Description |
|---|
IntArrayPriorityQueue()
Default Constructor
|
IntArrayPriorityQueue(int size)
Constructor with a Min Capacity
|
IntArrayPriorityQueue(int[] array)
Constructor using a initial array
|
IntArrayPriorityQueue(int[] array,
int size)
Constructor using a initial array
|
IntArrayPriorityQueue(int[] array,
IntComparator comp)
Constructor using a initial array and a custom sorter
|
IntArrayPriorityQueue(int[] array,
int size,
IntComparator comp)
Constructor using a initial array and a custom sorter
|
IntArrayPriorityQueue(IntCollection c)
Constructor using a Collection
|
IntArrayPriorityQueue(IntCollection c,
IntComparator comp)
Constructor using a Collection and a custom sorter
|
IntArrayPriorityQueue(IntComparator comp)
Constructor using custom sorter
|
IntArrayPriorityQueue(int size,
IntComparator comp)
Constructor with a Min Capacity and custom Sorter
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
clears all elements within the PriorityQueue,
this does not resize the backing arrays
|
IntComparator |
comparator() |
IntArrayPriorityQueue |
copy()
A Function that does a shallow clone of the PriorityQueue itself.
|
int |
count(Int2BooleanFunction filter)
Helper function to reduce stream usage that allows to count the valid elements.
|
int |
dequeue()
Method to extract a element from the PriorityQueue
|
void |
enqueue(int e)
Method to insert a element into the PriorityQueue
|
int |
findFirst(Int2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for the first match.
|
<E> void |
forEach(E input,
ObjectIntConsumer<E> action)
Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
void |
forEach(IntConsumer action)
A Type Specific foreach function that reduces (un)boxing
|
IntIterator |
iterator()
Returns an iterator over elements of type
T. |
boolean |
matchesAll(Int2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for all matches.
|
boolean |
matchesAny(Int2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for any matches.
|
boolean |
matchesNone(Int2BooleanFunction 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
|
int |
peek(int index)
Peeking function to see whats inside the queue.
|
int |
reduce(int identity,
IntIntUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
int |
reduce(IntIntUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
boolean |
removeFirst(int e)
Removes the first found element in the queue
|
boolean |
removeLast(int e)
Removes the last found element in the queue
|
int |
size() |
int[] |
toIntArray(int[] input)
A method to drop the contents of the Queue without clearing the queue
|
static IntArrayPriorityQueue |
wrap(int[] array)
Wrapping method to help serialization
|
static IntArrayPriorityQueue |
wrap(int[] array,
int size)
Wrapping method to help serialization
|
static IntArrayPriorityQueue |
wrap(int[] array,
IntComparator comp)
Wrapping method to help serialization, using a custom sorter
|
static IntArrayPriorityQueue |
wrap(int[] array,
int size,
IntComparator comp)
Wrapping method to help serialization, using a custom sorter
|
equals, hashCode, toStringenqueueAll, enqueueAll, enqueueAll, enqueueAll, first, isEmpty, synchronizeQueue, synchronizeQueue, toIntArrayarrayflatMap, asAsync, distinct, filter, flatMap, forEach, limit, map, peek, pour, pourAsList, pourAsSet, sorted, spliteratorpublic IntArrayPriorityQueue()
public IntArrayPriorityQueue(IntComparator comp)
comp - Comparator to sort the Array. Can be nullpublic IntArrayPriorityQueue(int size)
size - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public IntArrayPriorityQueue(int size,
IntComparator 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 IntArrayPriorityQueue(int[] array)
array - the Array that should be usedpublic IntArrayPriorityQueue(int[] 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 IntArrayPriorityQueue(int[] array,
IntComparator comp)
array - the Array that should be usedcomp - Comparator to sort the Array. Can be nullpublic IntArrayPriorityQueue(int[] array,
int size,
IntComparator 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 IntArrayPriorityQueue(IntCollection c)
c - the Collection that should be usedpublic IntArrayPriorityQueue(IntCollection c, IntComparator comp)
c - the Collection that should be usedcomp - Comparator to sort the Array. Can be nullpublic static IntArrayPriorityQueue wrap(int[] array)
array - the array that should be usedpublic static IntArrayPriorityQueue wrap(int[] array, int size)
array - the array that should be usedsize - the amount of elements within the arraypublic static IntArrayPriorityQueue wrap(int[] array, IntComparator comp)
array - the array that should be usedcomp - Comparator to sort the Array. Can be nullpublic static IntArrayPriorityQueue wrap(int[] array, int size, IntComparator comp)
array - the array that should be usedsize - the amount of elements within the arraycomp - Comparator to sort the Array. Can be nullpublic void enqueue(int e)
IntPriorityQueuee - the element that should be insertedpublic int dequeue()
IntPriorityQueuepublic int peek(int index)
IntPriorityQueueindex - of the element that is requested to be viewed.public boolean removeFirst(int e)
IntPriorityQueuee - the element that should be removedpublic boolean removeLast(int e)
IntPriorityQueuee - the element that should be removedpublic void onChanged()
IntPriorityQueuepublic int size()
public void clear()
IntPriorityQueuepublic void forEach(IntConsumer action)
IntIterableaction - The action to be performed for each elementIterable.forEach(Consumer)public <E> void forEach(E input,
ObjectIntConsumer<E> action)
IntIterableE - the generic type of the Objectinput - the object that should be includedaction - The action to be performed for each elementpublic boolean matchesAny(Int2BooleanFunction filter)
IntIterablefilter - that should be appliedpublic boolean matchesNone(Int2BooleanFunction filter)
IntIterablefilter - that should be appliedpublic boolean matchesAll(Int2BooleanFunction filter)
IntIterablefilter - that should be appliedpublic int reduce(int identity,
IntIntUnaryOperator operator)
IntIterableidentity - the start valueoperator - the operation that should be appliedpublic int reduce(IntIntUnaryOperator operator)
IntIterableoperator - the operation that should be appliedpublic int findFirst(Int2BooleanFunction filter)
IntIterablefilter - that should be appliedpublic int count(Int2BooleanFunction filter)
IntIterablefilter - that should be appliedpublic IntIterator iterator()
IntIterableT.public IntArrayPriorityQueue copy()
IntPriorityQueuepublic IntComparator comparator()
public int[] toIntArray(int[] input)
IntPriorityQueueinput - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array