public class BooleanArrayList extends AbstractBooleanList implements IBooleanArray, BooleanStack
This implementation is optimized to improve how data is processed with interfaces like IBooleanArray, BooleanStack
and with optimized functions that use type-specific implementations for primitives and optimized logic for bulkactions.
ISizeProvider.CollectionSize| Constructor and Description |
|---|
BooleanArrayList()
Creates a new ArrayList with a Empty array.
|
BooleanArrayList(boolean... a)
Creates a new ArrayList with a Copy of the array
|
BooleanArrayList(boolean[] a,
int length)
Creates a new ArrayList with a Copy of the array with a custom length
|
BooleanArrayList(boolean[] a,
int offset,
int length)
Creates a new ArrayList with a Copy of the array with in the custom range.
|
BooleanArrayList(BooleanCollection c)
Creates a new ArrayList a copy with the contents of the Collection.
|
BooleanArrayList(BooleanList l)
Creates a new ArrayList a copy with the contents of the List.
|
BooleanArrayList(java.util.Collection<? extends java.lang.Boolean> c)
Deprecated.
|
BooleanArrayList(int size)
Creates a new ArrayList with the specific requested size
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(boolean e)
Appends the specified element to the end of this list.
|
void |
add(int index,
boolean e)
Appends the specified element to the index of the list
|
boolean |
addAll(boolean[] e,
int offset,
int length)
A Type-Specific Array based addAll method to reduce the amount of Wrapping
|
boolean |
addAll(int index,
BooleanCollection c)
Appends the specified elements to the index of the list.
|
boolean |
addAll(int index,
BooleanList c)
Appends the specified elements to the index of the list.
|
boolean |
addAll(int index,
java.util.Collection<? extends java.lang.Boolean> c)
Deprecated.
|
void |
addElements(int from,
boolean[] a,
int offset,
int length)
Appends the specified array elements to the index of the list.
|
void |
clear()
A function to clear all elements in the list.
|
void |
clearAndTrim(int size)
Trims the collection down to the requested size and clears all elements while doing so
|
boolean |
contains(boolean e)
A Type Specific implementation of the Collection#contains function.
|
boolean |
contains(java.lang.Object o)
Deprecated.
|
BooleanArrayList |
copy()
A Function that does a shallow clone of the Collection itself.
|
int |
count(BooleanPredicate filter)
Helper function to reduce stream usage that allows to count the valid elements.
|
boolean[] |
elements()
Provides the Underlying Array in the Implementation
|
void |
ensureCapacity(int size)
Increases the capacity of this implementation instance, if necessary,
to ensure that it can hold at least the number of elements specified by
the minimum capacity argument.
|
boolean[] |
extractElements(int from,
int to)
A function to fast extract elements out of the list, this removes the elements that were fetched.
|
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.
|
boolean |
getBoolean(int index)
A Type-Specific get function to reduce (un)boxing
|
boolean[] |
getElements(int from,
boolean[] a,
int offset,
int length)
A function to fast fetch elements from the list
|
int |
indexOf(boolean e)
A Type-Specific function to find the index of a given element
|
int |
indexOf(java.lang.Object o)
Deprecated.
|
int |
lastIndexOf(boolean e)
A Type-Specific function to find the last index of a given element
|
int |
lastIndexOf(java.lang.Object o)
Deprecated.
|
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.
|
boolean |
peek(int index)
Provides the Selected Object from the stack.
|
boolean |
pop()
A Type-Specific pop function to reduce (un)boxing
|
void |
push(boolean e)
Appends the specified element to the end of this Stack.
|
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 |
remBoolean(boolean type)
A Type-Specific implementation of remove.
|
boolean |
removeAll(BooleanCollection c)
A function to remove all elements that were provided in the other collection
|
boolean |
removeAll(BooleanCollection c,
BooleanConsumer r)
A Type-Specific removeAll function that reduces (un)boxing.
|
boolean |
removeAll(java.util.Collection<?> c)
Deprecated.
|
boolean |
removeBoolean(int index)
A Type-Specific remove function to reduce (un)boxing
|
void |
removeElements(int from,
int to)
a function to fast remove elements from the list.
|
boolean |
removeIf(java.util.function.Predicate<? super java.lang.Boolean> filter)
Deprecated.
|
void |
replaceAll(java.util.function.UnaryOperator<java.lang.Boolean> o)
Deprecated.
|
boolean |
retainAll(BooleanCollection c)
A function to retain all elements that were provided in the other collection
This function might delegate to a more appropriate function if necessary
|
boolean |
retainAll(BooleanCollection c,
BooleanConsumer r)
A Type-Specific retainAll function that reduces (un)boxing.
|
boolean |
retainAll(java.util.Collection<?> c)
Deprecated.
|
boolean |
set(int index,
boolean e)
A Type-Specific set function to reduce (un)boxing
|
int |
size()
A function to return the size of the list
|
void |
size(int size)
A function to ensure the elements are within the requested size.
|
void |
sort(BooleanComparator c)
Sorts the elements specified by the Natural order either by using the Comparator or the elements
|
BooleanSplititerator |
spliterator()
A Type Specific Type Splititerator to reduce boxing/unboxing
|
boolean |
swapRemove(int index)
A Highly Optimized remove function that removes the desired element.
|
java.lang.Object[] |
toArray()
Deprecated.
|
<E> E[] |
toArray(E[] a)
Deprecated.
|
boolean[] |
toBooleanArray(boolean[] a)
A Type-Specific implementation of toArray.
|
boolean |
trim(int size)
Trims the original collection down to the size of the current elements or the requested size depending which is bigger
|
void |
unstableSort(BooleanComparator c)
Sorts the elements specified by the Natural order either by using the Comparator or the elements using a unstable sort
|
static BooleanArrayList |
wrap(boolean... a)
Creates a wrapped arraylist that uses the array as backing array
|
static BooleanArrayList |
wrap(boolean[] a,
int length)
Creates a wrapped arraylist that uses the array as backing array and a custom fill size
|
add, addAll, addAll, addAll, equals, hashCode, iterator, listIterator, listIterator, subList, swapRemoveBooleanadd, containsAll, containsAll, containsAny, containsAny, remove, toBooleanArrayelementsclearAndTrim, trimisEmpty, topadd, addElements, addElements, addIfAbsent, addIfPresent, forEachIndexed, get, getElements, remove, remove, set, sort, synchronize, synchronize, unmodifiable, unstableSortaddAll, addAll, containsAll, containsAny, containsAny, pour, toBooleanArrayarrayflatMap, asAsync, distinct, filter, flatMap, forEach, limit, map, peek, pourAsList, repeat, sortedofpublic BooleanArrayList()
public BooleanArrayList(int size)
size - the minimum initial size of the Backing array@Deprecated public BooleanArrayList(java.util.Collection<? extends java.lang.Boolean> c)
c - the elements that should be added into the listpublic BooleanArrayList(BooleanCollection c)
c - the elements that should be added into the listpublic BooleanArrayList(BooleanList l)
l - the elements that should be added into the listpublic BooleanArrayList(boolean... a)
a - the array that should be copiedpublic BooleanArrayList(boolean[] a,
int length)
a - the array that should be copiedlength - the desired length that should be copiedpublic BooleanArrayList(boolean[] a,
int offset,
int length)
a - the array that should be copiedoffset - the starting offset of where the array should be copied fromlength - the desired length that should be copiedjava.lang.IllegalStateException - if offset is smaller then 0java.lang.IllegalStateException - if the offset + length exceeds the array lengthpublic static BooleanArrayList wrap(boolean... a)
a - elements that should be wrappedpublic static BooleanArrayList wrap(boolean[] a, int length)
a - elements that should be wrappedlength - the size of the elements within the arraypublic boolean add(boolean e)
add in interface BooleanCollectionadd in interface BooleanListadd in class AbstractBooleanListe - element to be appended to this listCollection.add(E))List.add(Object)public void push(boolean e)
push in interface BooleanStacke - element to be appended to this StackStack.push(Object)public void add(int index,
boolean e)
add in interface BooleanListindex - the index where to append the element toe - the element to append to the listjava.lang.IndexOutOfBoundsException - if index is outside of the lists rangeList.add(int, Object)@Deprecated
public boolean addAll(int index,
java.util.Collection<? extends java.lang.Boolean> c)
addAll in interface java.util.List<java.lang.Boolean>index - the index where to append the elements toc - the elements to append to the listjava.lang.IndexOutOfBoundsException - if index is outside of the lists rangejava.lang.NullPointerException - if collection contains a null elementpublic boolean addAll(int index,
BooleanCollection c)
addAll in interface BooleanListindex - the index where to append the elements toc - the elements to append to the listjava.lang.IndexOutOfBoundsException - if index is outside of the lists rangeList.addAll(int, java.util.Collection)public boolean addAll(int index,
BooleanList c)
addAll in interface BooleanListindex - the index where to append the elements toc - the elements to append to the listjava.lang.IndexOutOfBoundsException - if index is outside of the lists rangepublic boolean addAll(boolean[] e,
int offset,
int length)
BooleanCollectionaddAll in interface BooleanCollectione - the elements that should be addedoffset - where to start within the arraylength - how many elements of the array should be addedpublic void addElements(int from,
boolean[] a,
int offset,
int length)
addElements in interface BooleanListfrom - the index where to append the elements toa - the elements to append to the listoffset - where to start ino the arraylength - the amount of elements to insertjava.lang.IndexOutOfBoundsException - if index is outside of the lists rangepublic boolean[] getElements(int from,
boolean[] a,
int offset,
int length)
getElements in interface BooleanListfrom - index where the list should be fetching elements froma - the array where the values should be inserted tooffset - the startIndex of where the array should be written tolength - the number of elements the values should be fetched fromjava.lang.NullPointerException - if the array is nulljava.lang.IndexOutOfBoundsException - if from is outside of the lists rangejava.lang.IllegalStateException - if offset or length are smaller then 0 or exceed the array lengthpublic void removeElements(int from,
int to)
removeElements in interface BooleanListfrom - the start index of where the elements should be removed from (inclusive)to - the end index of where the elements should be removed to (exclusive)public boolean[] extractElements(int from,
int to)
extractElements in interface BooleanListfrom - the start index of where the elements should be fetched from (inclusive)to - the end index of where the elements should be fetched to (exclusive)@Deprecated public boolean contains(java.lang.Object o)
contains in interface java.util.Collection<java.lang.Boolean>contains in interface java.util.List<java.lang.Boolean>contains in interface BooleanCollectioncontains in interface BooleanListcontains in class AbstractBooleanCollectiono - the element that is searched for@Deprecated public int indexOf(java.lang.Object o)
indexOf in interface java.util.List<java.lang.Boolean>indexOf in interface BooleanListindexOf in class AbstractBooleanListo - the element that is searched for@Deprecated public int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.List<java.lang.Boolean>lastIndexOf in interface BooleanListlastIndexOf in class AbstractBooleanListo - the element that is searched forpublic boolean contains(boolean e)
contains in interface BooleanCollectioncontains in class AbstractBooleanCollectione - the element that is searched for.public int indexOf(boolean e)
indexOf in interface BooleanListindexOf in class AbstractBooleanListe - the element that is searched forpublic int lastIndexOf(boolean e)
lastIndexOf in interface BooleanListlastIndexOf in class AbstractBooleanListe - the element that is searched forpublic void sort(BooleanComparator c)
sort in interface BooleanListc - the sorter of the elements, can be nullList.sort(java.util.Comparator),
BooleanArrays.stableSort(boolean[], BooleanComparator)public void unstableSort(BooleanComparator c)
unstableSort in interface BooleanListc - the sorter of the elements, can be nullList.sort(java.util.Comparator),
BooleanArrays.unstableSort(boolean[], BooleanComparator)public boolean getBoolean(int index)
getBoolean in interface BooleanListindex - the index of the element to fetchjava.lang.IndexOutOfBoundsException - if the index is out of rangeList.get(int)public boolean peek(int index)
peek in interface BooleanStackindex - of the element that should be providedjava.lang.ArrayIndexOutOfBoundsException - if the index is out of boundsStack.peek(int)public boolean[] elements()
elements in interface IBooleanArrayjava.lang.ClassCastException - if the return type does not match the underlying array. (Only for Object Implementations)public void forEach(BooleanConsumer action)
forEach in interface BooleanIterableaction - The action to be performed for each elementjava.lang.NullPointerException - if the specified action is nullIterable.forEach(java.util.function.Consumer)The default implementation behaves as if:
for(int i = 0;i<size;i++)
action.accept(data[i]);
public <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 set(int index,
boolean e)
set in interface BooleanListindex - the index of the element to sete - the value that should be setjava.lang.IndexOutOfBoundsException - if the index is out of rangeList.set(int, Object)@Deprecated public void replaceAll(java.util.function.UnaryOperator<java.lang.Boolean> o)
replaceAll in interface java.util.List<java.lang.Boolean>o - the action to replace the valuesjava.lang.NullPointerException - if o is nullpublic boolean removeBoolean(int index)
removeBoolean in interface BooleanListindex - the index of the element to fetchjava.lang.IndexOutOfBoundsException - if the index is out of rangeList.remove(int)public boolean swapRemove(int index)
BooleanListswapRemove in interface BooleanListindex - the index of the element to be removedpublic boolean remBoolean(boolean type)
remBoolean in interface BooleanCollectionremBoolean in class AbstractBooleanCollectiontype - the element that is searched forCollection.remove(Object)public boolean pop()
pop in interface BooleanStackjava.lang.IndexOutOfBoundsException - if the index is out of rangeStack.pop()@Deprecated public boolean removeAll(java.util.Collection<?> c)
removeAll in interface java.util.Collection<java.lang.Boolean>removeAll in interface java.util.List<java.lang.Boolean>removeAll in class java.util.AbstractCollection<java.lang.Boolean>c - the elements that should be removedjava.lang.NullPointerException - if the collection is null@Deprecated public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<java.lang.Boolean>retainAll in interface java.util.List<java.lang.Boolean>retainAll in class java.util.AbstractCollection<java.lang.Boolean>c - the elements that should be kept. If empty, BooleanArrayList#clear is called.java.lang.NullPointerException - if the collection is null@Deprecated public boolean removeIf(java.util.function.Predicate<? super java.lang.Boolean> filter)
removeIf in interface java.util.Collection<java.lang.Boolean>filter - the filter to remove elementspublic boolean removeAll(BooleanCollection c)
removeAll in interface BooleanCollectionremoveAll in class AbstractBooleanCollectionc - the elements that should be removedjava.lang.NullPointerException - if the collection is nullCollection.removeAll(Collection)public boolean removeAll(BooleanCollection c, BooleanConsumer r)
BooleanCollectionremoveAll in interface BooleanCollectionremoveAll in class AbstractBooleanCollectionc - the collection of elements that should be removedr - elements that got removedCollection.removeAll(Collection)public boolean retainAll(BooleanCollection c)
retainAll in interface BooleanCollectionretainAll in class AbstractBooleanCollectionc - the elements that should be kept. If empty, BooleanArrayList#clear is called.java.lang.NullPointerException - if the collection is nullCollection.retainAll(Collection)public boolean retainAll(BooleanCollection c, BooleanConsumer r)
BooleanCollectionretainAll in interface BooleanCollectionretainAll in class AbstractBooleanCollectionc - the collection of elements that should be keptr - elements that got removedCollection.retainAll(Collection)@Deprecated public java.lang.Object[] toArray()
toArray in interface java.util.Collection<java.lang.Boolean>toArray in interface java.util.List<java.lang.Boolean>toArray in class java.util.AbstractCollection<java.lang.Boolean>@Deprecated public <E> E[] toArray(E[] a)
toArray in interface java.util.Collection<java.lang.Boolean>toArray in interface java.util.List<java.lang.Boolean>toArray in class java.util.AbstractCollection<java.lang.Boolean>a - original array. If null a Object array with the right size is created. If to small the Array of the same type is created with the right sizepublic boolean[] toBooleanArray(boolean[] a)
AbstractBooleanCollectiontoBooleanArray in interface BooleanCollectiontoBooleanArray in class AbstractBooleanCollectiona - array that the elements should be injected to. If null or to small a new array with the right size is createdCollection.toArray(Object[])public int size()
size in interface java.util.Collection<java.lang.Boolean>size in interface java.util.List<java.lang.Boolean>size in interface BooleanStacksize in interface ISizeProvidersize in class java.util.AbstractCollection<java.lang.Boolean>public void size(int size)
size in interface BooleanListsize in class AbstractBooleanListsize - the requested amount of elements/room for elementspublic void clear()
clear in interface java.util.Collection<java.lang.Boolean>clear in interface java.util.List<java.lang.Boolean>clear in interface BooleanStackclear in class java.util.AbstractCollection<java.lang.Boolean>public boolean trim(int size)
trim in interface ITrimmablesize - the requested trim size.public void clearAndTrim(int size)
clearAndTrim in interface ITrimmablesize - the amount of elements that should be allowedpublic void ensureCapacity(int size)
ensureCapacity in interface IArraysize - the desired minimum capacitypublic BooleanArrayList copy()
BooleanCollectioncopy in interface BooleanCollectioncopy in interface BooleanListcopy in class AbstractBooleanListpublic BooleanSplititerator spliterator()
spliterator in interface java.lang.Iterable<java.lang.Boolean>spliterator in interface java.util.Collection<java.lang.Boolean>spliterator in interface java.util.List<java.lang.Boolean>spliterator in interface BooleanCollectionspliterator in interface BooleanIterablespliterator in interface BooleanList