public class DoubleArrayPriorityQueue extends AbstractDoublePriorityQueue
List.indexOf(Object) search.
It is highly suggested to use HeapPriorityQueue otherwise, unless you know why you need this specific implementation| Constructor and Description |
|---|
DoubleArrayPriorityQueue()
Default Constructor
|
DoubleArrayPriorityQueue(double[] array)
Constructor using a initial array
|
DoubleArrayPriorityQueue(double[] array,
DoubleComparator comp)
Constructor using a initial array and a custom sorter
|
DoubleArrayPriorityQueue(double[] array,
int size)
Constructor using a initial array
|
DoubleArrayPriorityQueue(double[] array,
int size,
DoubleComparator comp)
Constructor using a initial array and a custom sorter
|
DoubleArrayPriorityQueue(DoubleCollection c)
Constructor using a Collection
|
DoubleArrayPriorityQueue(DoubleCollection c,
DoubleComparator comp)
Constructor using a Collection and a custom sorter
|
DoubleArrayPriorityQueue(DoubleComparator comp)
Constructor using custom sorter
|
DoubleArrayPriorityQueue(int size)
Constructor with a Min Capacity
|
DoubleArrayPriorityQueue(int size,
DoubleComparator 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
|
DoubleComparator |
comparator() |
DoubleArrayPriorityQueue |
copy()
A Function that does a shallow clone of the PriorityQueue itself.
|
int |
count(java.util.function.DoublePredicate filter)
Helper function to reduce stream usage that allows to count the valid elements.
|
double |
dequeue()
Method to extract a element from the PriorityQueue
|
void |
enqueue(double e)
Method to insert a element into the PriorityQueue
|
double |
findFirst(java.util.function.DoublePredicate filter)
Helper function to reduce stream usage that allows to filter for the first match.
|
double |
first()
Shows the element that is to be returned next
|
void |
forEach(DoubleConsumer action)
A Type Specific foreach function that reduces (un)boxing
|
<E> void |
forEach(E input,
ObjectDoubleConsumer<E> action)
Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
void |
forEachIndexed(IntDoubleConsumer action)
A Indexed forEach implementation that allows you to keep track of how many elements were already iterated over.
|
DoubleIterator |
iterator()
Returns an iterator over elements of type
T. |
boolean |
matchesAll(java.util.function.DoublePredicate filter)
Helper function to reduce stream usage that allows to filter for all matches.
|
boolean |
matchesAny(java.util.function.DoublePredicate filter)
Helper function to reduce stream usage that allows to filter for any matches.
|
boolean |
matchesNone(java.util.function.DoublePredicate 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
|
double |
peek(int index)
Peeking function to see whats inside the queue.
|
double |
reduce(double identity,
DoubleDoubleUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
double |
reduce(DoubleDoubleUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
boolean |
removeFirst(double e)
Removes the first found element in the queue
|
boolean |
removeLast(double e)
Removes the last found element in the queue
|
int |
size() |
double[] |
toDoubleArray(double[] input)
A method to drop the contents of the Queue without clearing the queue
|
static DoubleArrayPriorityQueue |
wrap(double[] array)
Wrapping method to help serialization
|
static DoubleArrayPriorityQueue |
wrap(double[] array,
DoubleComparator comp)
Wrapping method to help serialization, using a custom sorter
|
static DoubleArrayPriorityQueue |
wrap(double[] array,
int size)
Wrapping method to help serialization
|
static DoubleArrayPriorityQueue |
wrap(double[] array,
int size,
DoubleComparator comp)
Wrapping method to help serialization, using a custom sorter
|
equals, hashCode, toStringenqueueAll, enqueueAll, enqueueAll, enqueueAll, isEmpty, synchronizeQueue, synchronizeQueue, toDoubleArrayarrayflatMap, asAsync, distinct, filter, flatMap, forEach, limit, map, peek, pour, pourAsList, pourAsSet, repeat, sorted, spliteratorpublic DoubleArrayPriorityQueue()
public DoubleArrayPriorityQueue(DoubleComparator comp)
comp - Comparator to sort the Array. Can be nullpublic DoubleArrayPriorityQueue(int size)
size - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public DoubleArrayPriorityQueue(int size,
DoubleComparator 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 DoubleArrayPriorityQueue(double[] array)
array - the Array that should be usedpublic DoubleArrayPriorityQueue(double[] 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 DoubleArrayPriorityQueue(double[] array,
DoubleComparator comp)
array - the Array that should be usedcomp - Comparator to sort the Array. Can be nullpublic DoubleArrayPriorityQueue(double[] array,
int size,
DoubleComparator 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 DoubleArrayPriorityQueue(DoubleCollection c)
c - the Collection that should be usedpublic DoubleArrayPriorityQueue(DoubleCollection c, DoubleComparator comp)
c - the Collection that should be usedcomp - Comparator to sort the Array. Can be nullpublic static DoubleArrayPriorityQueue wrap(double[] array)
array - the array that should be usedpublic static DoubleArrayPriorityQueue wrap(double[] array, int size)
array - the array that should be usedsize - the amount of elements within the arraypublic static DoubleArrayPriorityQueue wrap(double[] array, DoubleComparator comp)
array - the array that should be usedcomp - Comparator to sort the Array. Can be nullpublic static DoubleArrayPriorityQueue wrap(double[] array, int size, DoubleComparator 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(double e)
DoublePriorityQueuee - the element that should be insertedpublic double dequeue()
DoublePriorityQueuepublic double first()
DoublePriorityQueuepublic double peek(int index)
DoublePriorityQueueindex - of the element that is requested to be viewed.public boolean removeFirst(double e)
DoublePriorityQueuee - the element that should be removedpublic boolean removeLast(double e)
DoublePriorityQueuee - the element that should be removedpublic void onChanged()
DoublePriorityQueuepublic int size()
public void clear()
DoublePriorityQueuepublic void forEach(DoubleConsumer action)
DoubleIterableaction - The action to be performed for each elementIterable.forEach(Consumer)public void forEachIndexed(IntDoubleConsumer action)
DoubleIterableaction - The action to be performed for each elementpublic <E> void forEach(E input,
ObjectDoubleConsumer<E> action)
DoubleIterableE - the generic type of the Objectinput - the object that should be includedaction - The action to be performed for each elementpublic boolean matchesAny(java.util.function.DoublePredicate filter)
DoubleIterablefilter - that should be appliedpublic boolean matchesNone(java.util.function.DoublePredicate filter)
DoubleIterablefilter - that should be appliedpublic boolean matchesAll(java.util.function.DoublePredicate filter)
DoubleIterablefilter - that should be appliedpublic double reduce(double identity,
DoubleDoubleUnaryOperator operator)
DoubleIterableidentity - the start valueoperator - the operation that should be appliedpublic double reduce(DoubleDoubleUnaryOperator operator)
DoubleIterableoperator - the operation that should be appliedpublic double findFirst(java.util.function.DoublePredicate filter)
DoubleIterablefilter - that should be appliedpublic int count(java.util.function.DoublePredicate filter)
DoubleIterablefilter - that should be appliedpublic DoubleIterator iterator()
DoubleIterableT.public DoubleArrayPriorityQueue copy()
DoublePriorityQueuepublic DoubleComparator comparator()
public double[] toDoubleArray(double[] input)
DoublePriorityQueueinput - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array