public class ShortArrayFIFOQueue extends AbstractShortPriorityQueue implements ShortPriorityDequeue, ITrimmable
| Modifier and Type | Field and Description |
|---|---|
static int |
MIN_CAPACITY
The Minimum Capacity that is allowed
|
| Constructor and Description |
|---|
ShortArrayFIFOQueue()
Default Construtor
|
ShortArrayFIFOQueue(int capacity)
Constructor with a Min Capacity
|
ShortArrayFIFOQueue(short[] values)
Constructor using a initial array
|
ShortArrayFIFOQueue(short[] values,
int size)
Constructor using a initial array
|
ShortArrayFIFOQueue(short[] 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
|
ShortComparator |
comparator() |
ShortArrayFIFOQueue |
copy()
A Function that does a shallow clone of the PriorityQueue itself.
|
int |
count(Short2BooleanFunction filter)
Helper function to reduce stream usage that allows to count the valid elements.
|
short |
dequeue()
Method to extract a element from the PriorityQueue
|
short |
dequeueLast()
A Method to remove a element from the last place instead of the first
|
void |
enqueue(short e)
Method to insert a element into the PriorityQueue
|
void |
enqueueFirst(short e)
Method to insert a element into the first Index instead of the last.
|
short |
findFirst(Short2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for the first match.
|
<E> void |
forEach(E input,
ObjectShortConsumer<E> action)
Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
void |
forEach(ShortConsumer action)
A Type Specific foreach function that reduces (un)boxing
|
ShortIterator |
iterator()
Returns an iterator over elements of type
T. |
boolean |
matchesAll(Short2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for all matches.
|
boolean |
matchesAny(Short2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for any matches.
|
boolean |
matchesNone(Short2BooleanFunction 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
|
short |
peek(int index)
Peeking function to see whats inside the queue.
|
short |
reduce(short identity,
ShortShortUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
short |
reduce(ShortShortUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
boolean |
removeFirst(short e)
Removes the first found element in the queue
|
boolean |
removeLast(short e)
Removes the last found element in the queue
|
int |
size() |
short[] |
toShortArray(short[] 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, toShortArrayarrayflatMap, asAsync, distinct, filter, flatMap, forEach, limit, map, peek, pour, pourAsList, pourAsSet, sorted, spliteratorclearAndTrim, trimpublic static final int MIN_CAPACITY
public ShortArrayFIFOQueue(short[] values)
values - the Array that should be usedpublic ShortArrayFIFOQueue(short[] 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 ShortArrayFIFOQueue(short[] 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 ShortArrayFIFOQueue(int capacity)
capacity - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public ShortArrayFIFOQueue()
public ShortIterator iterator()
ShortIterableT.iterator in interface java.lang.Iterable<java.lang.Short>iterator in interface ShortIterablepublic int size()
size in interface ShortPriorityQueuepublic void clear()
ShortPriorityQueueclear in interface ShortPriorityQueuepublic void enqueue(short e)
ShortPriorityQueueenqueue in interface ShortPriorityQueuee - the element that should be insertedpublic void enqueueFirst(short e)
ShortPriorityDequeueenqueueFirst in interface ShortPriorityDequeuee - the element that should be inserted into the first placepublic short dequeue()
ShortPriorityQueuedequeue in interface ShortPriorityQueuepublic short dequeueLast()
ShortPriorityDequeuedequeueLast in interface ShortPriorityDequeuepublic short peek(int index)
ShortPriorityQueuepeek in interface ShortPriorityQueueindex - of the element that is requested to be viewed.public boolean removeFirst(short e)
ShortPriorityQueueremoveFirst in interface ShortPriorityQueuee - the element that should be removedpublic boolean removeLast(short e)
ShortPriorityQueueremoveLast in interface ShortPriorityQueuee - the element that should be removedpublic void onChanged()
ShortPriorityQueueonChanged in interface ShortPriorityQueuepublic ShortArrayFIFOQueue copy()
ShortPriorityQueuecopy in interface ShortPriorityDequeuecopy in interface ShortPriorityQueuepublic ShortComparator comparator()
comparator in interface ShortPriorityQueuepublic void forEach(ShortConsumer action)
ShortIterableforEach in interface ShortIterableaction - The action to be performed for each elementIterable.forEach(Consumer)public <E> void forEach(E input,
ObjectShortConsumer<E> action)
ShortIterableforEach in interface ShortIterableE - the generic type of the Objectinput - the object that should be includedaction - The action to be performed for each elementpublic boolean matchesAny(Short2BooleanFunction filter)
ShortIterablematchesAny in interface ShortIterablefilter - that should be appliedpublic boolean matchesNone(Short2BooleanFunction filter)
ShortIterablematchesNone in interface ShortIterablefilter - that should be appliedpublic boolean matchesAll(Short2BooleanFunction filter)
ShortIterablematchesAll in interface ShortIterablefilter - that should be appliedpublic short findFirst(Short2BooleanFunction filter)
ShortIterablefindFirst in interface ShortIterablefilter - that should be appliedpublic short reduce(short identity,
ShortShortUnaryOperator operator)
ShortIterablereduce in interface ShortIterableidentity - the start valueoperator - the operation that should be appliedpublic short reduce(ShortShortUnaryOperator operator)
ShortIterablereduce in interface ShortIterableoperator - the operation that should be appliedpublic int count(Short2BooleanFunction filter)
ShortIterablecount in interface ShortIterablefilter - 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 short[] toShortArray(short[] input)
ShortPriorityQueuetoShortArray in interface ShortPriorityQueueinput - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array