public class FloatArrayList extends AbstractFloatList implements IFloatArray, FloatStack
This implementation is optimized to improve how data is processed with interfaces like IFloatArray, FloatStack
and with optimized functions that use type-specific implementations for primitives and optimized logic for bulkactions.
ISizeProvider.CollectionSize| Constructor and Description |
|---|
FloatArrayList()
Creates a new ArrayList with a Empty array.
|
FloatArrayList(java.util.Collection<? extends java.lang.Float> c)
Deprecated.
|
FloatArrayList(float... a)
Creates a new ArrayList with a Copy of the array
|
FloatArrayList(float[] a,
int length)
Creates a new ArrayList with a Copy of the array with a custom length
|
FloatArrayList(float[] a,
int offset,
int length)
Creates a new ArrayList with a Copy of the array with in the custom range.
|
FloatArrayList(FloatCollection c)
Creates a new ArrayList a copy with the contents of the Collection.
|
FloatArrayList(FloatList l)
Creates a new ArrayList a copy with the contents of the List.
|
FloatArrayList(int size)
Creates a new ArrayList with the specific requested size
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(float e)
Appends the specified element to the end of this list.
|
void |
add(int index,
float e)
Appends the specified element to the index of the list
|
boolean |
addAll(float[] e,
int offset,
int length)
A Type-Specific Array based addAll method to reduce the amount of Wrapping
|
boolean |
addAll(int index,
java.util.Collection<? extends java.lang.Float> c)
Deprecated.
|
boolean |
addAll(int index,
FloatCollection c)
Appends the specified elements to the index of the list.
|
boolean |
addAll(int index,
FloatList c)
Appends the specified elements to the index of the list.
|
void |
addElements(int from,
float[] 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(float e)
A Type Specific implementation of the Collection#contains function.
|
boolean |
contains(java.lang.Object o)
Deprecated.
|
FloatArrayList |
copy()
A Function that does a shallow clone of the Collection itself.
|
int |
count(FloatPredicate filter)
Helper function to reduce stream usage that allows to count the valid elements.
|
float[] |
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.
|
float[] |
extractElements(int from,
int to)
A function to fast extract elements out of the list, this removes the elements that were fetched.
|
void |
fillBuffer(java.nio.FloatBuffer buffer)
Helper function that allows to fastFill a buffer reducing the duplication requirement
|
float |
findFirst(FloatPredicate filter)
Helper function to reduce stream usage that allows to filter for the first match.
|
<E> void |
forEach(E input,
ObjectFloatConsumer<E> action)
Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
void |
forEach(FloatConsumer action)
A Type Specific foreach function that reduces (un)boxing
|
float[] |
getElements(int from,
float[] a,
int offset,
int length)
A function to fast fetch elements from the list
|
float |
getFloat(int index)
A Type-Specific get function to reduce (un)boxing
|
int |
indexOf(float e)
A Type-Specific function to find the index of a given element
|
int |
indexOf(java.lang.Object o)
Deprecated.
|
int |
lastIndexOf(float e)
A Type-Specific function to find the last index of a given element
|
int |
lastIndexOf(java.lang.Object o)
Deprecated.
|
boolean |
matchesAll(FloatPredicate filter)
Helper function to reduce stream usage that allows to filter for all matches.
|
boolean |
matchesAny(FloatPredicate filter)
Helper function to reduce stream usage that allows to filter for any matches.
|
boolean |
matchesNone(FloatPredicate filter)
Helper function to reduce stream usage that allows to filter for no matches.
|
float |
peek(int index)
Provides the Selected Object from the stack.
|
float |
pop()
A Type-Specific pop function to reduce (un)boxing
|
java.util.stream.DoubleStream |
primitiveStream()
Returns a Java-Type-Specific Stream to reduce boxing/unboxing.
|
void |
push(float e)
Appends the specified element to the end of this Stack.
|
float |
reduce(float identity,
FloatFloatUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
float |
reduce(FloatFloatUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
boolean |
remFloat(float type)
A Type-Specific implementation of remove.
|
boolean |
remIf(java.util.function.DoublePredicate filter)
A optimized List#removeIf(Predicate) that more quickly removes elements from the list then the ArrayList implementation
|
boolean |
removeAll(java.util.Collection<?> c)
Deprecated.
|
boolean |
removeAll(FloatCollection c)
A function to remove all elements that were provided in the other collection
|
boolean |
removeAll(FloatCollection c,
FloatConsumer r)
A Type-Specific removeAll function that reduces (un)boxing.
|
void |
removeElements(int from,
int to)
a function to fast remove elements from the list.
|
float |
removeFloat(int index)
A Type-Specific remove function to reduce (un)boxing
|
boolean |
removeIf(java.util.function.Predicate<? super java.lang.Float> filter)
Deprecated.
|
void |
replaceAll(java.util.function.UnaryOperator<java.lang.Float> o)
Deprecated.
|
void |
replaceFloats(java.util.function.DoubleUnaryOperator o)
A Type-Specific replace function to reduce (un)boxing
|
boolean |
retainAll(java.util.Collection<?> c)
Deprecated.
|
boolean |
retainAll(FloatCollection 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(FloatCollection c,
FloatConsumer r)
A Type-Specific retainAll function that reduces (un)boxing.
|
float |
set(int index,
float 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(FloatComparator c)
Sorts the elements specified by the Natural order either by using the Comparator or the elements
|
FloatSplititerator |
spliterator()
A Type Specific Type Splititerator to reduce boxing/unboxing
|
float |
swapRemove(int index)
A Highly Optimized remove function that removes the desired element.
|
java.lang.Object[] |
toArray()
Deprecated.
|
<E> E[] |
toArray(E[] a)
Deprecated.
|
float[] |
toFloatArray(float[] 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(FloatComparator c)
Sorts the elements specified by the Natural order either by using the Comparator or the elements using a unstable sort
|
static FloatArrayList |
wrap(float... a)
Creates a wrapped arraylist that uses the array as backing array
|
static FloatArrayList |
wrap(float[] 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, swapRemoveFloatadd, containsAll, containsAll, containsAny, containsAny, remove, toFloatArrayelementsclearAndTrim, trimisEmpty, topadd, addElements, addElements, addIfAbsent, addIfPresent, forEachIndexed, get, getElements, remove, remove, set, sort, synchronize, synchronize, unmodifiable, unstableSortaddAll, addAll, containsAll, containsAny, containsAny, parallelPrimitiveStream, pour, toFloatArrayarrayflatMap, asAsync, distinct, filter, flatMap, forEach, limit, map, peek, pourAsList, pourAsSet, repeat, sortedofpublic FloatArrayList()
public FloatArrayList(int size)
size - the minimum initial size of the Backing array@Deprecated public FloatArrayList(java.util.Collection<? extends java.lang.Float> c)
c - the elements that should be added into the listpublic FloatArrayList(FloatCollection c)
c - the elements that should be added into the listpublic FloatArrayList(FloatList l)
l - the elements that should be added into the listpublic FloatArrayList(float... a)
a - the array that should be copiedpublic FloatArrayList(float[] a,
int length)
a - the array that should be copiedlength - the desired length that should be copiedpublic FloatArrayList(float[] 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 FloatArrayList wrap(float... a)
a - elements that should be wrappedpublic static FloatArrayList wrap(float[] a, int length)
a - elements that should be wrappedlength - the size of the elements within the arraypublic boolean add(float e)
add in interface FloatCollectionadd in interface FloatListadd in class AbstractFloatListe - element to be appended to this listCollection.add(E))List.add(Object)public void push(float e)
push in interface FloatStacke - element to be appended to this StackStack.push(Object)public void add(int index,
float e)
@Deprecated
public boolean addAll(int index,
java.util.Collection<? extends java.lang.Float> c)
addAll in interface java.util.List<java.lang.Float>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,
FloatCollection c)
addAll in interface FloatListindex - 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,
FloatList c)
public boolean addAll(float[] e,
int offset,
int length)
FloatCollectionaddAll in interface FloatCollectione - 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,
float[] a,
int offset,
int length)
addElements in interface FloatListfrom - 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 float[] getElements(int from,
float[] a,
int offset,
int length)
getElements in interface FloatListfrom - 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 FloatListfrom - 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 float[] extractElements(int from,
int to)
extractElements in interface FloatListfrom - 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)public void fillBuffer(java.nio.FloatBuffer buffer)
FloatListfillBuffer in interface FloatListbuffer - where the data should be stored in.@Deprecated public boolean contains(java.lang.Object o)
contains in interface java.util.Collection<java.lang.Float>contains in interface java.util.List<java.lang.Float>contains in interface FloatCollectioncontains in interface FloatListcontains in class AbstractFloatCollectiono - the element that is searched for@Deprecated public int indexOf(java.lang.Object o)
indexOf in interface java.util.List<java.lang.Float>indexOf in interface FloatListindexOf in class AbstractFloatListo - the element that is searched for@Deprecated public int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.List<java.lang.Float>lastIndexOf in interface FloatListlastIndexOf in class AbstractFloatListo - the element that is searched forpublic boolean contains(float e)
contains in interface FloatCollectioncontains in class AbstractFloatCollectione - the element that is searched for.public int indexOf(float e)
indexOf in interface FloatListindexOf in class AbstractFloatListe - the element that is searched forpublic int lastIndexOf(float e)
lastIndexOf in interface FloatListlastIndexOf in class AbstractFloatListe - the element that is searched forpublic void sort(FloatComparator c)
sort in interface FloatListc - the sorter of the elements, can be nullList.sort(java.util.Comparator),
FloatArrays.stableSort(float[], FloatComparator)public void unstableSort(FloatComparator c)
unstableSort in interface FloatListc - the sorter of the elements, can be nullList.sort(java.util.Comparator),
FloatArrays.unstableSort(float[], FloatComparator)public float getFloat(int index)
public float peek(int index)
peek in interface FloatStackindex - of the element that should be providedjava.lang.ArrayIndexOutOfBoundsException - if the index is out of boundsStack.peek(int)public float[] elements()
elements in interface IFloatArrayjava.lang.ClassCastException - if the return type does not match the underlying array. (Only for Object Implementations)public void forEach(FloatConsumer action)
forEach in interface FloatIterableaction - 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,
ObjectFloatConsumer<E> action)
FloatIterableforEach in interface FloatIterableE - the generic type of the Objectinput - the object that should be includedaction - The action to be performed for each elementpublic boolean matchesAny(FloatPredicate filter)
FloatIterablematchesAny in interface FloatIterablefilter - that should be appliedpublic boolean matchesNone(FloatPredicate filter)
FloatIterablematchesNone in interface FloatIterablefilter - that should be appliedpublic boolean matchesAll(FloatPredicate filter)
FloatIterablematchesAll in interface FloatIterablefilter - that should be appliedpublic float findFirst(FloatPredicate filter)
FloatIterablefindFirst in interface FloatIterablefilter - that should be appliedpublic float reduce(float identity,
FloatFloatUnaryOperator operator)
FloatIterablereduce in interface FloatIterableidentity - the start valueoperator - the operation that should be appliedpublic float reduce(FloatFloatUnaryOperator operator)
FloatIterablereduce in interface FloatIterableoperator - the operation that should be appliedpublic int count(FloatPredicate filter)
FloatIterablecount in interface FloatIterablefilter - that should be appliedpublic float set(int index,
float e)
@Deprecated public void replaceAll(java.util.function.UnaryOperator<java.lang.Float> o)
replaceAll in interface java.util.List<java.lang.Float>replaceAll in interface FloatListo - the action to replace the valuesjava.lang.NullPointerException - if o is nullpublic void replaceFloats(java.util.function.DoubleUnaryOperator o)
replaceFloats in interface FloatListo - the action to replace the valuesjava.lang.NullPointerException - if o is nullpublic float removeFloat(int index)
removeFloat in interface FloatListindex - the index of the element to fetchjava.lang.IndexOutOfBoundsException - if the index is out of rangeList.remove(int)public float swapRemove(int index)
FloatListswapRemove in interface FloatListindex - the index of the element to be removedpublic boolean remFloat(float type)
remFloat in interface FloatCollectionremFloat in class AbstractFloatCollectiontype - the element that is searched forCollection.remove(Object)public float pop()
pop in interface FloatStackjava.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.Float>removeAll in interface java.util.List<java.lang.Float>removeAll in class java.util.AbstractCollection<java.lang.Float>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.Float>retainAll in interface java.util.List<java.lang.Float>retainAll in class java.util.AbstractCollection<java.lang.Float>c - the elements that should be kept. If empty, FloatArrayList#clear is called.java.lang.NullPointerException - if the collection is null@Deprecated public boolean removeIf(java.util.function.Predicate<? super java.lang.Float> filter)
removeIf in interface java.util.Collection<java.lang.Float>removeIf in interface FloatCollectionfilter - the filter to remove elementspublic boolean removeAll(FloatCollection c)
removeAll in interface FloatCollectionremoveAll in class AbstractFloatCollectionc - the elements that should be removedjava.lang.NullPointerException - if the collection is nullCollection.removeAll(Collection)public boolean removeAll(FloatCollection c, FloatConsumer r)
FloatCollectionremoveAll in interface FloatCollectionremoveAll in class AbstractFloatCollectionc - the collection of elements that should be removedr - elements that got removedCollection.removeAll(Collection)public boolean retainAll(FloatCollection c)
retainAll in interface FloatCollectionretainAll in class AbstractFloatCollectionc - the elements that should be kept. If empty, FloatArrayList#clear is called.java.lang.NullPointerException - if the collection is nullCollection.retainAll(Collection)public boolean retainAll(FloatCollection c, FloatConsumer r)
FloatCollectionretainAll in interface FloatCollectionretainAll in class AbstractFloatCollectionc - the collection of elements that should be keptr - elements that got removedCollection.retainAll(Collection)public boolean remIf(java.util.function.DoublePredicate filter)
remIf in interface FloatCollectionfilter - the filter to remove elementsCollection.removeIf(Predicate)@Deprecated public java.lang.Object[] toArray()
toArray in interface java.util.Collection<java.lang.Float>toArray in interface java.util.List<java.lang.Float>toArray in class java.util.AbstractCollection<java.lang.Float>@Deprecated public <E> E[] toArray(E[] a)
toArray in interface java.util.Collection<java.lang.Float>toArray in interface java.util.List<java.lang.Float>toArray in class java.util.AbstractCollection<java.lang.Float>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 float[] toFloatArray(float[] a)
AbstractFloatCollectiontoFloatArray in interface FloatCollectiontoFloatArray in class AbstractFloatCollectiona - 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.Float>size in interface java.util.List<java.lang.Float>size in interface FloatStacksize in interface ISizeProvidersize in class java.util.AbstractCollection<java.lang.Float>public void size(int size)
size in interface FloatListsize in class AbstractFloatListsize - the requested amount of elements/room for elementspublic void clear()
clear in interface java.util.Collection<java.lang.Float>clear in interface java.util.List<java.lang.Float>clear in interface FloatStackclear in class java.util.AbstractCollection<java.lang.Float>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 FloatArrayList copy()
FloatCollectioncopy in interface FloatCollectioncopy in interface FloatListcopy in class AbstractFloatListpublic java.util.stream.DoubleStream primitiveStream()
primitiveStream in interface FloatCollectionpublic FloatSplititerator spliterator()
spliterator in interface java.lang.Iterable<java.lang.Float>spliterator in interface java.util.Collection<java.lang.Float>spliterator in interface java.util.List<java.lang.Float>spliterator in interface FloatCollectionspliterator in interface FloatIterablespliterator in interface FloatList