public class ByteArrayFIFOQueue extends AbstractBytePriorityQueue implements BytePriorityDequeue, ITrimmable
| Modifier and Type | Field and Description |
|---|---|
static int |
MIN_CAPACITY
The Minimum Capacity that is allowed
|
| Constructor and Description |
|---|
ByteArrayFIFOQueue()
Default Construtor
|
ByteArrayFIFOQueue(byte[] values)
Constructor using a initial array
|
ByteArrayFIFOQueue(byte[] values,
int size)
Constructor using a initial array
|
ByteArrayFIFOQueue(byte[] values,
int offset,
int size)
Constructor using a initial array
|
ByteArrayFIFOQueue(int capacity)
Constructor with a Min Capacity
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
clears all elements within the PriorityQueue,
this does not resize the backing arrays
|
void |
clearAndTrim(int size)
Trims the collection down to the requested size and clears all elements while doing so
|
ByteComparator |
comparator() |
ByteArrayFIFOQueue |
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
|
byte |
dequeueLast()
A Method to remove a element from the last place instead of the first
|
void |
enqueue(byte e)
Method to insert a element into the PriorityQueue
|
void |
enqueueFirst(byte e)
Method to insert a element into the first Index instead of the last.
|
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
|
boolean |
trim(int size)
Trims the original collection down to the size of the current elements or the requested size depending which is bigger
|
equals, hashCode, toStringenqueueAllFirst, enqueueAllFirst, enqueueAllFirst, enqueueAllFirst, last, synchronizeQueue, synchronizeQueueenqueueAll, enqueueAll, enqueueAll, enqueueAll, first, isEmpty, toByteArrayarrayflatMap, asAsync, distinct, filter, flatMap, forEach, limit, map, peek, pour, pourAsList, pourAsSet, sorted, spliteratorclearAndTrim, trimpublic static final int MIN_CAPACITY
public ByteArrayFIFOQueue(byte[] values)
values - the Array that should be usedpublic ByteArrayFIFOQueue(byte[] values,
int size)
values - the Array that should be usedsize - the amount of elements that are in the initial arrayjava.lang.IllegalStateException - if values is smaller then sizepublic ByteArrayFIFOQueue(byte[] values,
int offset,
int size)
values - the Array that should be usedoffset - where to begin in the initial arraysize - the amount of elements that are in the initial arrayjava.lang.IllegalStateException - if values is smaller then sizepublic ByteArrayFIFOQueue(int capacity)
capacity - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public ByteArrayFIFOQueue()
public ByteIterator iterator()
ByteIterableT.iterator in interface java.lang.Iterable<java.lang.Byte>iterator in interface ByteIterablepublic int size()
size in interface BytePriorityQueuepublic void clear()
BytePriorityQueueclear in interface BytePriorityQueuepublic void enqueue(byte e)
BytePriorityQueueenqueue in interface BytePriorityQueuee - the element that should be insertedpublic void enqueueFirst(byte e)
BytePriorityDequeueenqueueFirst in interface BytePriorityDequeuee - the element that should be inserted into the first placepublic byte dequeue()
BytePriorityQueuedequeue in interface BytePriorityQueuepublic byte dequeueLast()
BytePriorityDequeuedequeueLast in interface BytePriorityDequeuepublic byte peek(int index)
BytePriorityQueuepeek in interface BytePriorityQueueindex - of the element that is requested to be viewed.public boolean removeFirst(byte e)
BytePriorityQueueremoveFirst in interface BytePriorityQueuee - the element that should be removedpublic boolean removeLast(byte e)
BytePriorityQueueremoveLast in interface BytePriorityQueuee - the element that should be removedpublic void onChanged()
BytePriorityQueueonChanged in interface BytePriorityQueuepublic ByteArrayFIFOQueue copy()
BytePriorityQueuecopy in interface BytePriorityDequeuecopy in interface BytePriorityQueuepublic ByteComparator comparator()
comparator in interface BytePriorityQueuepublic void forEach(ByteConsumer action)
ByteIterableforEach in interface ByteIterableaction - The action to be performed for each elementIterable.forEach(Consumer)public <E> void forEach(E input,
ObjectByteConsumer<E> action)
ByteIterableforEach in interface 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)
ByteIterablematchesAny in interface ByteIterablefilter - that should be appliedpublic boolean matchesNone(Byte2BooleanFunction filter)
ByteIterablematchesNone in interface ByteIterablefilter - that should be appliedpublic boolean matchesAll(Byte2BooleanFunction filter)
ByteIterablematchesAll in interface ByteIterablefilter - that should be appliedpublic byte findFirst(Byte2BooleanFunction filter)
ByteIterablefindFirst in interface ByteIterablefilter - that should be appliedpublic byte reduce(byte identity,
ByteByteUnaryOperator operator)
ByteIterablereduce in interface ByteIterableidentity - the start valueoperator - the operation that should be appliedpublic byte reduce(ByteByteUnaryOperator operator)
ByteIterablereduce in interface ByteIterableoperator - the operation that should be appliedpublic int count(Byte2BooleanFunction filter)
ByteIterablecount in interface ByteIterablefilter - that should be appliedpublic boolean trim(int size)
ITrimmabletrim in interface ITrimmablesize - the requested trim size.public void clearAndTrim(int size)
clearAndTrim in interface ITrimmablesize - the amount of elements that should be allowedpublic byte[] toByteArray(byte[] input)
BytePriorityQueuetoByteArray in interface BytePriorityQueueinput - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array