public class CopyOnWriteDoubleArrayList extends AbstractDoubleList implements ITrimmable, DoubleStack
This implementation is optimized to improve how data is processed with interfaces like ITrimmable, DoubleStack
and with optimized functions that use type-specific implementations for primitives and optimized logic for bulkactions.
ISizeProvider.CollectionSize| Constructor and Description |
|---|
CopyOnWriteDoubleArrayList()
Creates a new ArrayList with a Empty array.
|
CopyOnWriteDoubleArrayList(java.util.Collection<? extends java.lang.Double> c)
Deprecated.
|
CopyOnWriteDoubleArrayList(double... a)
Creates a new ArrayList with a Copy of the array
|
CopyOnWriteDoubleArrayList(double[] a,
int length)
Creates a new ArrayList with a Copy of the array with a custom length
|
CopyOnWriteDoubleArrayList(double[] a,
int offset,
int length)
Creates a new ArrayList with a Copy of the array with in the custom range.
|
CopyOnWriteDoubleArrayList(DoubleCollection c)
Creates a new ArrayList a copy with the contents of the Collection.
|
CopyOnWriteDoubleArrayList(DoubleList l)
Creates a new ArrayList a copy with the contents of the List.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(double e)
Appends the specified element to the end of this list.
|
void |
add(int index,
double e)
Appends the specified element to the index of the list
|
boolean |
addAll(double[] 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.Double> c)
Deprecated.
|
boolean |
addAll(int index,
DoubleCollection c)
Appends the specified elements to the index of the list.
|
boolean |
addAll(int index,
DoubleList c)
Appends the specified elements to the index of the list.
|
void |
addElements(int from,
double[] 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(double e)
A Type Specific implementation of the Collection#contains function.
|
boolean |
contains(java.lang.Object o)
Deprecated.
|
CopyOnWriteDoubleArrayList |
copy()
A Function that does a shallow clone of the Collection itself.
|
int |
count(java.util.function.DoublePredicate filter)
Helper function to reduce stream usage that allows to count the valid elements.
|
double[] |
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.DoubleBuffer buffer)
Helper function that allows to fastFill a buffer reducing the duplication requirement
|
double |
findFirst(java.util.function.DoublePredicate filter)
Helper function to reduce stream usage that allows to filter for the first match.
|
void |
forEach(DoubleConsumer action)
A Type Specific foreach function that reduces (un)boxing
|
<E> void |
forEach(E input,
ObjectDoubleConsumer<E> action)
Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
double |
getDouble(int index)
A Type-Specific get function to reduce (un)boxing
|
double[] |
getElements(int from,
double[] a,
int offset,
int length)
A function to fast fetch elements from the list
|
int |
indexOf(double e)
A Type-Specific function to find the index of a given element
|
int |
indexOf(java.lang.Object o)
Deprecated.
|
int |
lastIndexOf(double e)
A Type-Specific function to find the last index of a given element
|
int |
lastIndexOf(java.lang.Object o)
Deprecated.
|
DoubleListIterator |
listIterator(int index)
A Type-Specific Iterator of listIterator
|
boolean |
matchesAll(java.util.function.DoublePredicate filter)
Helper function to reduce stream usage that allows to filter for all matches.
|
boolean |
matchesAny(java.util.function.DoublePredicate filter)
Helper function to reduce stream usage that allows to filter for any matches.
|
boolean |
matchesNone(java.util.function.DoublePredicate filter)
Helper function to reduce stream usage that allows to filter for no matches.
|
double |
peek(int index)
Provides the Selected Object from the stack.
|
double |
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(double e)
Appends the specified element to the end of this Stack.
|
double |
reduce(double identity,
DoubleDoubleUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
double |
reduce(DoubleDoubleUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
boolean |
remDouble(double 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(DoubleCollection c)
A function to remove all elements that were provided in the other collection
|
boolean |
removeAll(DoubleCollection c,
DoubleConsumer r)
A Type-Specific removeAll function that reduces (un)boxing.
|
double |
removeDouble(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.Double> filter)
Deprecated.
|
void |
replaceAll(java.util.function.UnaryOperator<java.lang.Double> o)
Deprecated.
|
void |
replaceDoubles(java.util.function.DoubleUnaryOperator o)
A Type-Specific replace function to reduce (un)boxing
|
boolean |
retainAll(java.util.Collection<?> c)
Deprecated.
|
boolean |
retainAll(DoubleCollection 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(DoubleCollection c,
DoubleConsumer r)
A Type-Specific retainAll function that reduces (un)boxing.
|
double |
set(int index,
double 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(DoubleComparator c)
Sorts the elements specified by the Natural order either by using the Comparator or the elements
|
DoubleSplititerator |
spliterator()
A Type Specific Type Splititerator to reduce boxing/unboxing
|
DoubleList |
subList(int fromIndex,
int toIndex)
A Type-Specific List of subList
|
double |
swapRemove(int index)
A Highly Optimized remove function that removes the desired element.
|
java.lang.Object[] |
toArray()
Deprecated.
|
<E> E[] |
toArray(E[] a)
Deprecated.
|
double[] |
toDoubleArray(double[] 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(DoubleComparator c)
Sorts the elements specified by the Natural order either by using the Comparator or the elements using a unstable sort
|
add, addAll, addAll, addAll, equals, hashCode, iterator, listIterator, swapRemoveDoubleadd, containsAll, containsAll, containsAny, containsAny, remove, toDoubleArrayclearAndTrim, trimisEmpty, topadd, addElements, addElements, addIfAbsent, addIfPresent, forEachIndexed, get, getElements, remove, remove, set, sort, synchronize, synchronize, unmodifiable, unstableSortaddAll, addAll, containsAll, containsAny, containsAny, parallelPrimitiveStream, pour, toDoubleArrayarrayflatMap, asAsync, distinct, filter, flatMap, forEach, limit, map, peek, pourAsList, pourAsSet, repeat, sortedofpublic CopyOnWriteDoubleArrayList()
@Deprecated public CopyOnWriteDoubleArrayList(java.util.Collection<? extends java.lang.Double> c)
c - the elements that should be added into the listpublic CopyOnWriteDoubleArrayList(DoubleCollection c)
c - the elements that should be added into the listpublic CopyOnWriteDoubleArrayList(DoubleList l)
l - the elements that should be added into the listpublic CopyOnWriteDoubleArrayList(double... a)
a - the array that should be copiedpublic CopyOnWriteDoubleArrayList(double[] a,
int length)
a - the array that should be copiedlength - the desired length that should be copiedpublic CopyOnWriteDoubleArrayList(double[] 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 boolean add(double e)
add in interface DoubleCollectionadd in interface DoubleListadd in class AbstractDoubleListe - element to be appended to this listCollection.add(E))List.add(Object)public void push(double e)
push in interface DoubleStacke - element to be appended to this StackStack.push(Object)public void add(int index,
double e)
add in interface DoubleListindex - 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.Double> c)
addAll in interface java.util.List<java.lang.Double>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,
DoubleCollection c)
addAll in interface DoubleListindex - 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,
DoubleList c)
addAll in interface DoubleListindex - 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(double[] e,
int offset,
int length)
DoubleCollectionaddAll in interface DoubleCollectione - 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,
double[] a,
int offset,
int length)
addElements in interface DoubleListfrom - 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 double[] getElements(int from,
double[] a,
int offset,
int length)
getElements in interface DoubleListfrom - 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 DoubleListfrom - 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 double[] extractElements(int from,
int to)
extractElements in interface DoubleListfrom - 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.DoubleBuffer buffer)
DoubleListfillBuffer in interface DoubleListbuffer - where the data should be stored in.@Deprecated public boolean contains(java.lang.Object o)
contains in interface java.util.Collection<java.lang.Double>contains in interface java.util.List<java.lang.Double>contains in interface DoubleCollectioncontains in interface DoubleListcontains in class AbstractDoubleCollectiono - the element that is searched for@Deprecated public int indexOf(java.lang.Object o)
indexOf in interface java.util.List<java.lang.Double>indexOf in interface DoubleListindexOf in class AbstractDoubleListo - the element that is searched for@Deprecated public int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.List<java.lang.Double>lastIndexOf in interface DoubleListlastIndexOf in class AbstractDoubleListo - the element that is searched forpublic boolean contains(double e)
contains in interface DoubleCollectioncontains in class AbstractDoubleCollectione - the element that is searched for.public int indexOf(double e)
indexOf in interface DoubleListindexOf in class AbstractDoubleListe - the element that is searched forpublic int lastIndexOf(double e)
lastIndexOf in interface DoubleListlastIndexOf in class AbstractDoubleListe - the element that is searched forpublic void sort(DoubleComparator c)
sort in interface DoubleListc - the sorter of the elements, can be nullList.sort(java.util.Comparator),
DoubleArrays.stableSort(double[], DoubleComparator)public void unstableSort(DoubleComparator c)
unstableSort in interface DoubleListc - the sorter of the elements, can be nullList.sort(java.util.Comparator),
DoubleArrays.unstableSort(double[], DoubleComparator)public double getDouble(int index)
getDouble in interface DoubleListindex - the index of the element to fetchjava.lang.IndexOutOfBoundsException - if the index is out of rangeList.get(int)public double peek(int index)
peek in interface DoubleStackindex - of the element that should be providedjava.lang.ArrayIndexOutOfBoundsException - if the index is out of boundsStack.peek(int)public DoubleListIterator listIterator(int index)
DoubleListlistIterator in interface java.util.List<java.lang.Double>listIterator in interface DoubleListlistIterator in class AbstractDoubleListList.listIterator(int)public DoubleList subList(int fromIndex, int toIndex)
DoubleListsubList in interface java.util.List<java.lang.Double>subList in interface DoubleListsubList in class AbstractDoubleListList.subList(int, int)public void forEach(DoubleConsumer action)
forEach in interface DoubleIterableaction - 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,m=data.length;i<m;i++)
action.accept(data[i]);
public <E> void forEach(E input,
ObjectDoubleConsumer<E> action)
DoubleIterableforEach in interface DoubleIterableE - the generic type of the Objectinput - the object that should be includedaction - The action to be performed for each elementpublic boolean matchesAny(java.util.function.DoublePredicate filter)
DoubleIterablematchesAny in interface DoubleIterablefilter - that should be appliedpublic boolean matchesNone(java.util.function.DoublePredicate filter)
DoubleIterablematchesNone in interface DoubleIterablefilter - that should be appliedpublic boolean matchesAll(java.util.function.DoublePredicate filter)
DoubleIterablematchesAll in interface DoubleIterablefilter - that should be appliedpublic double findFirst(java.util.function.DoublePredicate filter)
DoubleIterablefindFirst in interface DoubleIterablefilter - that should be appliedpublic double reduce(double identity,
DoubleDoubleUnaryOperator operator)
DoubleIterablereduce in interface DoubleIterableidentity - the start valueoperator - the operation that should be appliedpublic double reduce(DoubleDoubleUnaryOperator operator)
DoubleIterablereduce in interface DoubleIterableoperator - the operation that should be appliedpublic int count(java.util.function.DoublePredicate filter)
DoubleIterablecount in interface DoubleIterablefilter - that should be appliedpublic double set(int index,
double e)
set in interface DoubleListindex - 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.Double> o)
replaceAll in interface java.util.List<java.lang.Double>replaceAll in interface DoubleListo - the action to replace the valuesjava.lang.NullPointerException - if o is nullpublic void replaceDoubles(java.util.function.DoubleUnaryOperator o)
replaceDoubles in interface DoubleListo - the action to replace the valuesjava.lang.NullPointerException - if o is nullpublic double removeDouble(int index)
removeDouble in interface DoubleListindex - the index of the element to fetchjava.lang.IndexOutOfBoundsException - if the index is out of rangeList.remove(int)public double swapRemove(int index)
DoubleListswapRemove in interface DoubleListindex - the index of the element to be removedpublic boolean remDouble(double type)
remDouble in interface DoubleCollectionremDouble in class AbstractDoubleCollectiontype - the element that is searched forCollection.remove(Object)public double pop()
pop in interface DoubleStackjava.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.Double>removeAll in interface java.util.List<java.lang.Double>removeAll in class java.util.AbstractCollection<java.lang.Double>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.Double>retainAll in interface java.util.List<java.lang.Double>retainAll in class java.util.AbstractCollection<java.lang.Double>c - the elements that should be kept. If empty, LongArrayList#clear is called.java.lang.NullPointerException - if the collection is null@Deprecated public boolean removeIf(java.util.function.Predicate<? super java.lang.Double> filter)
removeIf in interface java.util.Collection<java.lang.Double>removeIf in interface DoubleCollectionfilter - the filter to remove elementspublic boolean removeAll(DoubleCollection c)
removeAll in interface DoubleCollectionremoveAll in class AbstractDoubleCollectionc - the elements that should be removedjava.lang.NullPointerException - if the collection is nullCollection.removeAll(Collection)public boolean removeAll(DoubleCollection c, DoubleConsumer r)
DoubleCollectionremoveAll in interface DoubleCollectionremoveAll in class AbstractDoubleCollectionc - the collection of elements that should be removedr - elements that got removedCollection.removeAll(Collection)public boolean retainAll(DoubleCollection c)
retainAll in interface DoubleCollectionretainAll in class AbstractDoubleCollectionc - the elements that should be kept. If empty, LongArrayList#clear is called.java.lang.NullPointerException - if the collection is nullCollection.retainAll(Collection)public boolean retainAll(DoubleCollection c, DoubleConsumer r)
DoubleCollectionretainAll in interface DoubleCollectionretainAll in class AbstractDoubleCollectionc - 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 DoubleCollectionfilter - the filter to remove elementsCollection.removeIf(Predicate)@Deprecated public java.lang.Object[] toArray()
toArray in interface java.util.Collection<java.lang.Double>toArray in interface java.util.List<java.lang.Double>toArray in class java.util.AbstractCollection<java.lang.Double>@Deprecated public <E> E[] toArray(E[] a)
toArray in interface java.util.Collection<java.lang.Double>toArray in interface java.util.List<java.lang.Double>toArray in class java.util.AbstractCollection<java.lang.Double>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 double[] toDoubleArray(double[] a)
AbstractDoubleCollectiontoDoubleArray in interface DoubleCollectiontoDoubleArray in class AbstractDoubleCollectiona - 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.Double>size in interface java.util.List<java.lang.Double>size in interface DoubleStacksize in interface ISizeProvidersize in class java.util.AbstractCollection<java.lang.Double>public void size(int size)
size in interface DoubleListsize in class AbstractDoubleListsize - the requested amount of elements/room for elementspublic void clear()
clear in interface java.util.Collection<java.lang.Double>clear in interface java.util.List<java.lang.Double>clear in interface DoubleStackclear in class java.util.AbstractCollection<java.lang.Double>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 CopyOnWriteDoubleArrayList copy()
DoubleCollectioncopy in interface DoubleCollectioncopy in interface DoubleListcopy in class AbstractDoubleListpublic java.util.stream.DoubleStream primitiveStream()
primitiveStream in interface DoubleCollectionpublic DoubleSplititerator spliterator()
spliterator in interface java.lang.Iterable<java.lang.Double>spliterator in interface java.util.Collection<java.lang.Double>spliterator in interface java.util.List<java.lang.Double>spliterator in interface DoubleCollectionspliterator in interface DoubleIterablespliterator in interface DoubleList