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