public class CharArrayFIFOQueue extends AbstractCharPriorityQueue implements CharPriorityDequeue, ITrimmable
| Modifier and Type | Field and Description |
|---|---|
static int |
MIN_CAPACITY
The Minimum Capacity that is allowed
|
| Constructor and Description |
|---|
CharArrayFIFOQueue()
Default Construtor
|
CharArrayFIFOQueue(char[] values)
Constructor using a initial array
|
CharArrayFIFOQueue(char[] values,
int size)
Constructor using a initial array
|
CharArrayFIFOQueue(char[] values,
int offset,
int size)
Constructor using a initial array
|
CharArrayFIFOQueue(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
|
CharComparator |
comparator() |
CharArrayFIFOQueue |
copy()
A Function that does a shallow clone of the PriorityQueue itself.
|
int |
count(CharPredicate filter)
Helper function to reduce stream usage that allows to count the valid elements.
|
char |
dequeue()
Method to extract a element from the PriorityQueue
|
char |
dequeueLast()
A Method to remove a element from the last place instead of the first
|
void |
enqueue(char e)
Method to insert a element into the PriorityQueue
|
void |
enqueueFirst(char e)
Method to insert a element into the first Index instead of the last.
|
char |
findFirst(CharPredicate filter)
Helper function to reduce stream usage that allows to filter for the first match.
|
void |
forEach(CharConsumer action)
A Type Specific foreach function that reduces (un)boxing
|
<E> void |
forEach(E input,
ObjectCharConsumer<E> action)
Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
void |
forEachIndexed(IntCharConsumer action)
A Indexed forEach implementation that allows you to keep track of how many elements were already iterated over.
|
CharIterator |
iterator()
Returns an iterator over elements of type
T. |
boolean |
matchesAll(CharPredicate filter)
Helper function to reduce stream usage that allows to filter for all matches.
|
boolean |
matchesAny(CharPredicate filter)
Helper function to reduce stream usage that allows to filter for any matches.
|
boolean |
matchesNone(CharPredicate 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
|
char |
peek(int index)
Peeking function to see whats inside the queue.
|
char |
reduce(char identity,
CharCharUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
char |
reduce(CharCharUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
boolean |
removeFirst(char e)
Removes the first found element in the queue
|
boolean |
removeLast(char e)
Removes the last found element in the queue
|
int |
size() |
char[] |
toCharArray(char[] 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, toCharArrayarrayflatMap, asAsync, distinct, filter, flatMap, forEach, limit, map, peek, pour, pourAsList, pourAsSet, repeat, sorted, spliteratorclearAndTrim, trimpublic static final int MIN_CAPACITY
public CharArrayFIFOQueue(char[] values)
values - the Array that should be usedpublic CharArrayFIFOQueue(char[] 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 CharArrayFIFOQueue(char[] 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 CharArrayFIFOQueue(int capacity)
capacity - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public CharArrayFIFOQueue()
public CharIterator iterator()
CharIterableT.iterator in interface java.lang.Iterable<java.lang.Character>iterator in interface CharIterablepublic int size()
size in interface CharPriorityQueuepublic void clear()
CharPriorityQueueclear in interface CharPriorityQueuepublic void enqueue(char e)
CharPriorityQueueenqueue in interface CharPriorityQueuee - the element that should be insertedpublic void enqueueFirst(char e)
CharPriorityDequeueenqueueFirst in interface CharPriorityDequeuee - the element that should be inserted into the first placepublic char dequeue()
CharPriorityQueuedequeue in interface CharPriorityQueuepublic char dequeueLast()
CharPriorityDequeuedequeueLast in interface CharPriorityDequeuepublic char peek(int index)
CharPriorityQueuepeek in interface CharPriorityQueueindex - of the element that is requested to be viewed.public boolean removeFirst(char e)
CharPriorityQueueremoveFirst in interface CharPriorityQueuee - the element that should be removedpublic boolean removeLast(char e)
CharPriorityQueueremoveLast in interface CharPriorityQueuee - the element that should be removedpublic void onChanged()
CharPriorityQueueonChanged in interface CharPriorityQueuepublic CharArrayFIFOQueue copy()
CharPriorityQueuecopy in interface CharPriorityDequeuecopy in interface CharPriorityQueuepublic CharComparator comparator()
comparator in interface CharPriorityQueuepublic void forEach(CharConsumer action)
CharIterableforEach in interface CharIterableaction - The action to be performed for each elementIterable.forEach(Consumer)public void forEachIndexed(IntCharConsumer action)
CharIterableforEachIndexed in interface CharIterableaction - The action to be performed for each elementpublic <E> void forEach(E input,
ObjectCharConsumer<E> action)
CharIterableforEach in interface CharIterableE - the generic type of the Objectinput - the object that should be includedaction - The action to be performed for each elementpublic boolean matchesAny(CharPredicate filter)
CharIterablematchesAny in interface CharIterablefilter - that should be appliedpublic boolean matchesNone(CharPredicate filter)
CharIterablematchesNone in interface CharIterablefilter - that should be appliedpublic boolean matchesAll(CharPredicate filter)
CharIterablematchesAll in interface CharIterablefilter - that should be appliedpublic char findFirst(CharPredicate filter)
CharIterablefindFirst in interface CharIterablefilter - that should be appliedpublic char reduce(char identity,
CharCharUnaryOperator operator)
CharIterablereduce in interface CharIterableidentity - the start valueoperator - the operation that should be appliedpublic char reduce(CharCharUnaryOperator operator)
CharIterablereduce in interface CharIterableoperator - the operation that should be appliedpublic int count(CharPredicate filter)
CharIterablecount in interface CharIterablefilter - 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 char[] toCharArray(char[] input)
CharPriorityQueuetoCharArray in interface CharPriorityQueueinput - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array