public class LongArrayFIFOQueue extends AbstractLongPriorityQueue implements LongPriorityDequeue, ITrimmable
| Modifier and Type | Field and Description |
|---|---|
static int |
MIN_CAPACITY
The Minimum Capacity that is allowed
|
| Constructor and Description |
|---|
LongArrayFIFOQueue()
Default Construtor
|
LongArrayFIFOQueue(int capacity)
Constructor with a Min Capacity
|
LongArrayFIFOQueue(long[] values)
Constructor using a initial array
|
LongArrayFIFOQueue(long[] values,
int size)
Constructor using a initial array
|
LongArrayFIFOQueue(long[] 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
|
LongComparator |
comparator() |
LongArrayFIFOQueue |
copy()
A Function that does a shallow clone of the PriorityQueue itself.
|
int |
count(Long2BooleanFunction filter)
Helper function to reduce stream usage that allows to count the valid elements.
|
long |
dequeue()
Method to extract a element from the PriorityQueue
|
long |
dequeueLast()
A Method to remove a element from the last place instead of the first
|
void |
enqueue(long e)
Method to insert a element into the PriorityQueue
|
void |
enqueueFirst(long e)
Method to insert a element into the first Index instead of the last.
|
long |
findFirst(Long2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for the first match.
|
<E> void |
forEach(E input,
ObjectLongConsumer<E> action)
Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
void |
forEach(LongConsumer action)
A Type Specific foreach function that reduces (un)boxing
|
LongIterator |
iterator()
Returns an iterator over elements of type
T. |
boolean |
matchesAll(Long2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for all matches.
|
boolean |
matchesAny(Long2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for any matches.
|
boolean |
matchesNone(Long2BooleanFunction 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
|
long |
peek(int index)
Peeking function to see whats inside the queue.
|
long |
reduce(long identity,
LongLongUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
long |
reduce(LongLongUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
boolean |
removeFirst(long e)
Removes the first found element in the queue
|
boolean |
removeLast(long e)
Removes the last found element in the queue
|
int |
size() |
long[] |
toLongArray(long[] 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, toLongArrayarrayflatMap, asAsync, distinct, filter, flatMap, forEach, limit, map, peek, pour, pourAsList, pourAsSet, sorted, spliteratorclearAndTrim, trimpublic static final int MIN_CAPACITY
public LongArrayFIFOQueue(long[] values)
values - the Array that should be usedpublic LongArrayFIFOQueue(long[] 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 LongArrayFIFOQueue(long[] 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 LongArrayFIFOQueue(int capacity)
capacity - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public LongArrayFIFOQueue()
public LongIterator iterator()
LongIterableT.iterator in interface java.lang.Iterable<java.lang.Long>iterator in interface LongIterablepublic int size()
size in interface LongPriorityQueuepublic void clear()
LongPriorityQueueclear in interface LongPriorityQueuepublic void enqueue(long e)
LongPriorityQueueenqueue in interface LongPriorityQueuee - the element that should be insertedpublic void enqueueFirst(long e)
LongPriorityDequeueenqueueFirst in interface LongPriorityDequeuee - the element that should be inserted into the first placepublic long dequeue()
LongPriorityQueuedequeue in interface LongPriorityQueuepublic long dequeueLast()
LongPriorityDequeuedequeueLast in interface LongPriorityDequeuepublic long peek(int index)
LongPriorityQueuepeek in interface LongPriorityQueueindex - of the element that is requested to be viewed.public boolean removeFirst(long e)
LongPriorityQueueremoveFirst in interface LongPriorityQueuee - the element that should be removedpublic boolean removeLast(long e)
LongPriorityQueueremoveLast in interface LongPriorityQueuee - the element that should be removedpublic void onChanged()
LongPriorityQueueonChanged in interface LongPriorityQueuepublic LongArrayFIFOQueue copy()
LongPriorityQueuecopy in interface LongPriorityDequeuecopy in interface LongPriorityQueuepublic LongComparator comparator()
comparator in interface LongPriorityQueuepublic void forEach(LongConsumer action)
LongIterableforEach in interface LongIterableaction - The action to be performed for each elementIterable.forEach(Consumer)public <E> void forEach(E input,
ObjectLongConsumer<E> action)
LongIterableforEach in interface LongIterableE - the generic type of the Objectinput - the object that should be includedaction - The action to be performed for each elementpublic boolean matchesAny(Long2BooleanFunction filter)
LongIterablematchesAny in interface LongIterablefilter - that should be appliedpublic boolean matchesNone(Long2BooleanFunction filter)
LongIterablematchesNone in interface LongIterablefilter - that should be appliedpublic boolean matchesAll(Long2BooleanFunction filter)
LongIterablematchesAll in interface LongIterablefilter - that should be appliedpublic long findFirst(Long2BooleanFunction filter)
LongIterablefindFirst in interface LongIterablefilter - that should be appliedpublic long reduce(long identity,
LongLongUnaryOperator operator)
LongIterablereduce in interface LongIterableidentity - the start valueoperator - the operation that should be appliedpublic long reduce(LongLongUnaryOperator operator)
LongIterablereduce in interface LongIterableoperator - the operation that should be appliedpublic int count(Long2BooleanFunction filter)
LongIterablecount in interface LongIterablefilter - 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 long[] toLongArray(long[] input)
LongPriorityQueuetoLongArray in interface LongPriorityQueueinput - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array