public class BooleanArrayFIFOQueue extends AbstractBooleanPriorityQueue implements BooleanPriorityDequeue, ITrimmable
| Modifier and Type | Field and Description |
|---|---|
static int |
MIN_CAPACITY
The Minimum Capacity that is allowed
|
| Constructor and Description |
|---|
BooleanArrayFIFOQueue()
Default Construtor
|
BooleanArrayFIFOQueue(boolean[] values)
Constructor using a initial array
|
BooleanArrayFIFOQueue(boolean[] values,
int size)
Constructor using a initial array
|
BooleanArrayFIFOQueue(boolean[] values,
int offset,
int size)
Constructor using a initial array
|
BooleanArrayFIFOQueue(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
|
BooleanComparator |
comparator() |
BooleanArrayFIFOQueue |
copy()
A Function that does a shallow clone of the PriorityQueue itself.
|
int |
count(BooleanPredicate filter)
Helper function to reduce stream usage that allows to count the valid elements.
|
boolean |
dequeue()
Method to extract a element from the PriorityQueue
|
boolean |
dequeueLast()
A Method to remove a element from the last place instead of the first
|
void |
enqueue(boolean e)
Method to insert a element into the PriorityQueue
|
void |
enqueueFirst(boolean e)
Method to insert a element into the first Index instead of the last.
|
boolean |
findFirst(BooleanPredicate filter)
Helper function to reduce stream usage that allows to filter for the first match.
|
void |
forEach(BooleanConsumer action)
A Type Specific foreach function that reduces (un)boxing
|
<E> void |
forEach(E input,
ObjectBooleanConsumer<E> action)
Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
void |
forEachIndexed(IntBooleanConsumer action)
A Indexed forEach implementation that allows you to keep track of how many elements were already iterated over.
|
BooleanIterator |
iterator()
Returns an iterator over elements of type
T. |
boolean |
matchesAll(BooleanPredicate filter)
Helper function to reduce stream usage that allows to filter for all matches.
|
boolean |
matchesAny(BooleanPredicate filter)
Helper function to reduce stream usage that allows to filter for any matches.
|
boolean |
matchesNone(BooleanPredicate 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
|
boolean |
peek(int index)
Peeking function to see whats inside the queue.
|
boolean |
reduce(boolean identity,
BooleanBooleanUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
boolean |
reduce(BooleanBooleanUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
boolean |
removeFirst(boolean e)
Removes the first found element in the queue
|
boolean |
removeLast(boolean e)
Removes the last found element in the queue
|
int |
size() |
boolean[] |
toBooleanArray(boolean[] 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, toBooleanArrayarrayflatMap, asAsync, distinct, filter, flatMap, forEach, limit, map, peek, pour, pourAsList, repeat, sorted, spliteratorclearAndTrim, trimpublic static final int MIN_CAPACITY
public BooleanArrayFIFOQueue(boolean[] values)
values - the Array that should be usedpublic BooleanArrayFIFOQueue(boolean[] 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 BooleanArrayFIFOQueue(boolean[] 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 BooleanArrayFIFOQueue(int capacity)
capacity - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public BooleanArrayFIFOQueue()
public BooleanIterator iterator()
BooleanIterableT.iterator in interface java.lang.Iterable<java.lang.Boolean>iterator in interface BooleanIterablepublic int size()
size in interface BooleanPriorityQueuepublic void clear()
BooleanPriorityQueueclear in interface BooleanPriorityQueuepublic void enqueue(boolean e)
BooleanPriorityQueueenqueue in interface BooleanPriorityQueuee - the element that should be insertedpublic void enqueueFirst(boolean e)
BooleanPriorityDequeueenqueueFirst in interface BooleanPriorityDequeuee - the element that should be inserted into the first placepublic boolean dequeue()
BooleanPriorityQueuedequeue in interface BooleanPriorityQueuepublic boolean dequeueLast()
BooleanPriorityDequeuedequeueLast in interface BooleanPriorityDequeuepublic boolean peek(int index)
BooleanPriorityQueuepeek in interface BooleanPriorityQueueindex - of the element that is requested to be viewed.public boolean removeFirst(boolean e)
BooleanPriorityQueueremoveFirst in interface BooleanPriorityQueuee - the element that should be removedpublic boolean removeLast(boolean e)
BooleanPriorityQueueremoveLast in interface BooleanPriorityQueuee - the element that should be removedpublic void onChanged()
BooleanPriorityQueueonChanged in interface BooleanPriorityQueuepublic BooleanArrayFIFOQueue copy()
BooleanPriorityQueuecopy in interface BooleanPriorityDequeuecopy in interface BooleanPriorityQueuepublic BooleanComparator comparator()
comparator in interface BooleanPriorityQueuepublic void forEach(BooleanConsumer action)
BooleanIterableforEach in interface BooleanIterableaction - The action to be performed for each elementIterable.forEach(Consumer)public void forEachIndexed(IntBooleanConsumer action)
BooleanIterableforEachIndexed in interface BooleanIterableaction - The action to be performed for each elementpublic <E> void forEach(E input,
ObjectBooleanConsumer<E> action)
BooleanIterableforEach in interface BooleanIterableE - the generic type of the Objectinput - the object that should be includedaction - The action to be performed for each elementpublic boolean matchesAny(BooleanPredicate filter)
BooleanIterablematchesAny in interface BooleanIterablefilter - that should be appliedpublic boolean matchesNone(BooleanPredicate filter)
BooleanIterablematchesNone in interface BooleanIterablefilter - that should be appliedpublic boolean matchesAll(BooleanPredicate filter)
BooleanIterablematchesAll in interface BooleanIterablefilter - that should be appliedpublic boolean findFirst(BooleanPredicate filter)
BooleanIterablefindFirst in interface BooleanIterablefilter - that should be appliedpublic boolean reduce(boolean identity,
BooleanBooleanUnaryOperator operator)
BooleanIterablereduce in interface BooleanIterableidentity - the start valueoperator - the operation that should be appliedpublic boolean reduce(BooleanBooleanUnaryOperator operator)
BooleanIterablereduce in interface BooleanIterableoperator - the operation that should be appliedpublic int count(BooleanPredicate filter)
BooleanIterablecount in interface BooleanIterablefilter - 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 boolean[] toBooleanArray(boolean[] input)
BooleanPriorityQueuetoBooleanArray in interface BooleanPriorityQueueinput - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array