public class IntArrayFIFOQueue extends AbstractIntPriorityQueue implements IntPriorityDequeue, ITrimmable
| Modifier and Type | Field and Description |
|---|---|
static int |
MIN_CAPACITY
The Minimum Capacity that is allowed
|
| Constructor and Description |
|---|
IntArrayFIFOQueue()
Default Construtor
|
IntArrayFIFOQueue(int capacity)
Constructor with a Min Capacity
|
IntArrayFIFOQueue(int[] values)
Constructor using a initial array
|
IntArrayFIFOQueue(int[] values,
int size)
Constructor using a initial array
|
IntArrayFIFOQueue(int[] values,
int offset,
int size)
Constructor using a initial array
|
| 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
|
IntComparator |
comparator() |
IntArrayFIFOQueue |
copy()
A Function that does a shallow clone of the PriorityQueue itself.
|
int |
count(java.util.function.IntPredicate filter)
Helper function to reduce stream usage that allows to count the valid elements.
|
int |
dequeue()
Method to extract a element from the PriorityQueue
|
int |
dequeueLast()
A Method to remove a element from the last place instead of the first
|
void |
enqueue(int e)
Method to insert a element into the PriorityQueue
|
void |
enqueueFirst(int e)
Method to insert a element into the first Index instead of the last.
|
int |
findFirst(java.util.function.IntPredicate filter)
Helper function to reduce stream usage that allows to filter for the first match.
|
<E> void |
forEach(E input,
ObjectIntConsumer<E> action)
Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
void |
forEach(IntConsumer action)
A Type Specific foreach function that reduces (un)boxing
|
void |
forEachIndexed(IntIntConsumer action)
A Indexed forEach implementation that allows you to keep track of how many elements were already iterated over.
|
IntIterator |
iterator()
Returns an iterator over elements of type
T. |
boolean |
matchesAll(java.util.function.IntPredicate filter)
Helper function to reduce stream usage that allows to filter for all matches.
|
boolean |
matchesAny(java.util.function.IntPredicate filter)
Helper function to reduce stream usage that allows to filter for any matches.
|
boolean |
matchesNone(java.util.function.IntPredicate 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
|
int |
peek(int index)
Peeking function to see whats inside the queue.
|
int |
reduce(int identity,
IntIntUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
int |
reduce(IntIntUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
boolean |
removeFirst(int e)
Removes the first found element in the queue
|
boolean |
removeLast(int e)
Removes the last found element in the queue
|
int |
size() |
int[] |
toIntArray(int[] 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, toIntArrayarrayflatMap, asAsync, distinct, filter, flatMap, forEach, limit, map, peek, pour, pourAsList, pourAsSet, repeat, sorted, spliteratorclearAndTrim, trimpublic static final int MIN_CAPACITY
public IntArrayFIFOQueue(int[] values)
values - the Array that should be usedpublic IntArrayFIFOQueue(int[] 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 IntArrayFIFOQueue(int[] 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 IntArrayFIFOQueue(int capacity)
capacity - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public IntArrayFIFOQueue()
public IntIterator iterator()
IntIterableT.iterator in interface java.lang.Iterable<java.lang.Integer>iterator in interface IntIterablepublic int size()
size in interface IntPriorityQueuepublic void clear()
IntPriorityQueueclear in interface IntPriorityQueuepublic void enqueue(int e)
IntPriorityQueueenqueue in interface IntPriorityQueuee - the element that should be insertedpublic void enqueueFirst(int e)
IntPriorityDequeueenqueueFirst in interface IntPriorityDequeuee - the element that should be inserted into the first placepublic int dequeue()
IntPriorityQueuedequeue in interface IntPriorityQueuepublic int dequeueLast()
IntPriorityDequeuedequeueLast in interface IntPriorityDequeuepublic int peek(int index)
IntPriorityQueuepeek in interface IntPriorityQueueindex - of the element that is requested to be viewed.public boolean removeFirst(int e)
IntPriorityQueueremoveFirst in interface IntPriorityQueuee - the element that should be removedpublic boolean removeLast(int e)
IntPriorityQueueremoveLast in interface IntPriorityQueuee - the element that should be removedpublic void onChanged()
IntPriorityQueueonChanged in interface IntPriorityQueuepublic IntArrayFIFOQueue copy()
IntPriorityQueuecopy in interface IntPriorityDequeuecopy in interface IntPriorityQueuepublic IntComparator comparator()
comparator in interface IntPriorityQueuepublic void forEach(IntConsumer action)
IntIterableforEach in interface IntIterableaction - The action to be performed for each elementIterable.forEach(Consumer)public void forEachIndexed(IntIntConsumer action)
IntIterableforEachIndexed in interface IntIterableaction - The action to be performed for each elementpublic <E> void forEach(E input,
ObjectIntConsumer<E> action)
IntIterableforEach in interface IntIterableE - 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.IntPredicate filter)
IntIterablematchesAny in interface IntIterablefilter - that should be appliedpublic boolean matchesNone(java.util.function.IntPredicate filter)
IntIterablematchesNone in interface IntIterablefilter - that should be appliedpublic boolean matchesAll(java.util.function.IntPredicate filter)
IntIterablematchesAll in interface IntIterablefilter - that should be appliedpublic int findFirst(java.util.function.IntPredicate filter)
IntIterablefindFirst in interface IntIterablefilter - that should be appliedpublic int reduce(int identity,
IntIntUnaryOperator operator)
IntIterablereduce in interface IntIterableidentity - the start valueoperator - the operation that should be appliedpublic int reduce(IntIntUnaryOperator operator)
IntIterablereduce in interface IntIterableoperator - the operation that should be appliedpublic int count(java.util.function.IntPredicate filter)
IntIterablecount in interface IntIterablefilter - 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 int[] toIntArray(int[] input)
IntPriorityQueuetoIntArray in interface IntPriorityQueueinput - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array