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