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