Class DoubleArrayList
java.lang.Object
org.eclipse.collections.impl.primitive.AbstractDoubleIterable
org.eclipse.collections.impl.list.mutable.primitive.DoubleArrayList
- All Implemented Interfaces:
Externalizable,Serializable,MutableDoubleCollection,DoubleIterable,DoubleList,MutableDoubleList,OrderedDoubleIterable,ReversibleDoubleIterable,PrimitiveIterable
public class DoubleArrayList
extends AbstractDoubleIterable
implements MutableDoubleList, Externalizable
DoubleArrayList is similar to FastList, and is memory-optimized for double primitives.
This file was automatically generated from template file primitiveArrayList.stg.
- Since:
- 3.0.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(double newItem) booleanaddAll(double... source) booleanaddAll(DoubleIterable source) booleanaddAllAtIndex(int index, double... source) booleanaddAllAtIndex(int index, DoubleIterable source) voidaddAtIndex(int index, double element) booleanallSatisfy(DoublePredicate predicate) Returns true if all of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.booleananySatisfy(DoublePredicate predicate) Returns true if any of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.voidappendString(Appendable appendable, String start, String separator, String end) Prints a string representation of this collection onto the givenAppendable.intbinarySearch(double value) chunk(int size) Partitions elements in fixed size chunks.voidclear()<V> MutableList<V>collect(DoubleToObjectFunction<? extends V> function) Returns a new collection with the results of applying the specified function on each element of the source collection.<V,R extends Collection<V>>
Rcollect(DoubleToObjectFunction<? extends V> function, R target) Same asDoubleIterable.collect(DoubleToObjectFunction), only the results are added to the target Collection.booleancontains(double value) Returns true if the value is contained in the DoubleIterable, and false if it is not.intcount(DoublePredicate predicate) Returns a count of the number of elements in the DoubleIterable that return true for the specified predicate.doubledetectIfNone(DoublePredicate predicate, double ifNone) distinct()doubledotProduct(DoubleList list) Returns a primitive iterator that can be used to iterate over the DoubleIterable in an imperative style.voideach(DoubleProcedure procedure) A synonym for forEach.voidensureCapacity(int minCapacity) booleanFollows the same general contract asList.equals(Object).voidforEachWithIndex(DoubleIntProcedure procedure) doubleget(int index) doublegetFirst()doublegetLast()inthashCode()Follows the same general contract asList.hashCode().intindexOf(double value) <T> TinjectInto(T injectedValue, ObjectDoubleToObjectFunction<? super T, ? extends T> function) <T> TinjectIntoWithIndex(T injectedValue, ObjectDoubleIntToObjectFunction<? super T, ? extends T> function) intlastIndexOf(double value) doublemax()doublemin()newEmpty()Creates a new empty DoubleArrayList.static DoubleArrayListnewList(DoubleIterable source) static DoubleArrayListnewListWith(double... elements) Creates a new list using the passedelementsargument as the backing store.static DoubleArrayListnewWithNValues(int size, double value) voidreject(DoublePredicate predicate) Returns a new DoubleIterable with all of the elements in the DoubleIterable that return false for the specified predicate.<R extends MutableDoubleCollection>
Rreject(DoublePredicate predicate, R target) Same asDoubleIterable.reject(DoublePredicate), only the results are added to the target MutableDoubleCollection.booleanremove(double value) booleanremoveAll(double... source) booleanremoveAll(DoubleIterable source) doubleremoveAtIndex(int index) booleanremoveIf(DoublePredicate predicate) booleanretainAll(double... source) booleanretainAll(DoubleIterable source) select(DoublePredicate predicate) Returns a new DoubleIterable with all of the elements in the DoubleIterable that return true for the specified predicate.<R extends MutableDoubleCollection>
Rselect(DoublePredicate predicate, R target) Same asDoubleIterable.select(DoublePredicate), only the results are added to the target MutableDoubleCollection.doubleset(int index, double element) intsize()Returns the number of items in this iterable.sortThis()Sorts this list mutating its contents and returns the same mutable list (this).sortThis(DoubleComparator comparator) Sorts the internal data structure of this list and returns the list itself as a convenience.subList(int fromIndex, int toIndex) doublesum()voidswap(int index1, int index2) double[]toArray()Converts the DoubleIterable to a primitive double array.double[]toArray(double[] target) Converts the DoubleIterable to a primitive double array.Returns an immutable copy of this list.voidwith(double element) with(double element1, double element2) with(double element1, double element2, double element3) with(double element1, double element2, double element3, double... elements) withAll(DoubleIterable elements) without(double element) withoutAll(DoubleIterable elements) static DoubleArrayListwrapCopy(double... array) Creates a new list by first copying the array passed in.void<T> MutableList<DoubleObjectPair<T>>Returns aMutableListformed from thisMutableDoubleListand aListIterableby combining corresponding elements in pairs.zipDouble(DoubleIterable iterable) Returns aMutableListformed from thisMutableDoubleListand anotherDoubleListby combining corresponding elements in pairs.Methods inherited from class org.eclipse.collections.impl.primitive.AbstractDoubleIterable
asLazy, average, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toStringMethods inherited from interface org.eclipse.collections.api.DoubleIterable
asLazy, average, averageIfEmpty, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAll, containsAll, containsAny, containsAny, containsNone, containsNone, flatCollect, forEach, injectIntoBoolean, injectIntoByte, injectIntoChar, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, injectIntoShort, maxIfEmpty, median, medianIfEmpty, minIfEmpty, noneSatisfy, reduce, reduceIfEmpty, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedList, toSortedList, toSortedListBy, toSortedListByMethods inherited from interface org.eclipse.collections.api.list.primitive.DoubleList
forEachInBoth, primitiveParallelStream, primitiveStreamMethods inherited from interface org.eclipse.collections.api.list.primitive.MutableDoubleList
collectWithIndex, rejectWithIndex, selectWithIndex, shuffleThis, shuffleThis, sortThisBy, sortThisBy, tapMethods inherited from interface org.eclipse.collections.api.ordered.primitive.OrderedDoubleIterable
collectWithIndex, rejectWithIndex, selectWithIndexMethods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, toString
-
Constructor Details
-
DoubleArrayList
public DoubleArrayList() -
DoubleArrayList
public DoubleArrayList(int initialCapacity) -
DoubleArrayList
public DoubleArrayList(double... array)
-
-
Method Details
-
newListWith
Creates a new list using the passedelementsargument as the backing store.!!! WARNING: This method uses the passed in array, so can be very unsafe if the original array is held onto anywhere else. !!!
-
newList
-
newWithNValues
-
wrapCopy
Creates a new list by first copying the array passed in. -
size
public int size()Description copied from interface:PrimitiveIterableReturns the number of items in this iterable.- Specified by:
sizein interfacePrimitiveIterable
-
clear
public void clear()- Specified by:
clearin interfaceMutableDoubleCollection
-
contains
public boolean contains(double value) Description copied from interface:DoubleIterableReturns true if the value is contained in the DoubleIterable, and false if it is not.- Specified by:
containsin interfaceDoubleIterable
-
get
public double get(int index) - Specified by:
getin interfaceDoubleList
-
getFirst
public double getFirst()- Specified by:
getFirstin interfaceOrderedDoubleIterable
-
getLast
public double getLast()- Specified by:
getLastin interfaceReversibleDoubleIterable
-
indexOf
public int indexOf(double value) - Specified by:
indexOfin interfaceOrderedDoubleIterable
-
lastIndexOf
public int lastIndexOf(double value) - Specified by:
lastIndexOfin interfaceDoubleList
-
trimToSize
public void trimToSize() -
ensureCapacity
public void ensureCapacity(int minCapacity) -
add
public boolean add(double newItem) - Specified by:
addin interfaceMutableDoubleCollection
-
addAll
public boolean addAll(double... source) - Specified by:
addAllin interfaceMutableDoubleCollection
-
addAll
- Specified by:
addAllin interfaceMutableDoubleCollection
-
addAtIndex
public void addAtIndex(int index, double element) - Specified by:
addAtIndexin interfaceMutableDoubleList
-
addAllAtIndex
public boolean addAllAtIndex(int index, double... source) - Specified by:
addAllAtIndexin interfaceMutableDoubleList
-
addAllAtIndex
- Specified by:
addAllAtIndexin interfaceMutableDoubleList
-
remove
public boolean remove(double value) - Specified by:
removein interfaceMutableDoubleCollection
-
removeIf
- Specified by:
removeIfin interfaceMutableDoubleCollection
-
removeAll
- Specified by:
removeAllin interfaceMutableDoubleCollection
-
removeAll
public boolean removeAll(double... source) - Specified by:
removeAllin interfaceMutableDoubleCollection
-
retainAll
- Specified by:
retainAllin interfaceMutableDoubleCollection- See Also:
-
retainAll
public boolean retainAll(double... source) - Specified by:
retainAllin interfaceMutableDoubleCollection- See Also:
-
removeAtIndex
public double removeAtIndex(int index) - Specified by:
removeAtIndexin interfaceMutableDoubleList
-
set
public double set(int index, double element) - Specified by:
setin interfaceMutableDoubleList
-
swap
public void swap(int index1, int index2) - Specified by:
swapin interfaceMutableDoubleList
-
with
- Specified by:
within interfaceMutableDoubleCollection- Specified by:
within interfaceMutableDoubleList
-
without
- Specified by:
withoutin interfaceMutableDoubleCollection- Specified by:
withoutin interfaceMutableDoubleList
-
withAll
- Specified by:
withAllin interfaceMutableDoubleCollection- Specified by:
withAllin interfaceMutableDoubleList
-
withoutAll
- Specified by:
withoutAllin interfaceMutableDoubleCollection- Specified by:
withoutAllin interfaceMutableDoubleList
-
with
-
with
-
with
-
doubleIterator
Description copied from interface:DoubleIterableReturns a primitive iterator that can be used to iterate over the DoubleIterable in an imperative style.- Specified by:
doubleIteratorin interfaceDoubleIterable- Specified by:
doubleIteratorin interfaceMutableDoubleCollection
-
each
Description copied from interface:DoubleIterableA synonym for forEach.- Specified by:
eachin interfaceDoubleIterable- Since:
- 7.0.
-
forEachWithIndex
- Specified by:
forEachWithIndexin interfaceOrderedDoubleIterable
-
injectInto
public <T> T injectInto(T injectedValue, ObjectDoubleToObjectFunction<? super T, ? extends T> function) - Specified by:
injectIntoin interfaceDoubleIterable
-
injectIntoWithIndex
public <T> T injectIntoWithIndex(T injectedValue, ObjectDoubleIntToObjectFunction<? super T, ? extends T> function) - Specified by:
injectIntoWithIndexin interfaceOrderedDoubleIterable- Specified by:
injectIntoWithIndexin interfaceReversibleDoubleIterable
-
chunk
Description copied from interface:DoubleIterablePartitions elements in fixed size chunks.- Specified by:
chunkin interfaceDoubleIterable- Parameters:
size- the number of elements per chunk- Returns:
- A
RichIterablecontainingDoubleIterables of sizesize, except the last will be truncated if the elements don't divide evenly.
-
count
Description copied from interface:DoubleIterableReturns a count of the number of elements in the DoubleIterable that return true for the specified predicate.- Specified by:
countin interfaceDoubleIterable
-
anySatisfy
Description copied from interface:DoubleIterableReturns true if any of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfyin interfaceDoubleIterable
-
allSatisfy
Description copied from interface:DoubleIterableReturns true if all of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfyin interfaceDoubleIterable
-
select
Description copied from interface:DoubleIterableReturns a new DoubleIterable with all of the elements in the DoubleIterable that return true for the specified predicate.- Specified by:
selectin interfaceDoubleIterable- Specified by:
selectin interfaceDoubleList- Specified by:
selectin interfaceMutableDoubleCollection- Specified by:
selectin interfaceMutableDoubleList- Specified by:
selectin interfaceOrderedDoubleIterable- Specified by:
selectin interfaceReversibleDoubleIterable
-
select
Description copied from interface:DoubleIterableSame asDoubleIterable.select(DoublePredicate), only the results are added to the target MutableDoubleCollection.- Specified by:
selectin interfaceDoubleIterable- Since:
- 8.1.
-
reject
Description copied from interface:DoubleIterableReturns a new DoubleIterable with all of the elements in the DoubleIterable that return false for the specified predicate.- Specified by:
rejectin interfaceDoubleIterable- Specified by:
rejectin interfaceDoubleList- Specified by:
rejectin interfaceMutableDoubleCollection- Specified by:
rejectin interfaceMutableDoubleList- Specified by:
rejectin interfaceOrderedDoubleIterable- Specified by:
rejectin interfaceReversibleDoubleIterable
-
reject
Description copied from interface:DoubleIterableSame asDoubleIterable.reject(DoublePredicate), only the results are added to the target MutableDoubleCollection.- Specified by:
rejectin interfaceDoubleIterable- Since:
- 8.1.
-
detectIfNone
- Specified by:
detectIfNonein interfaceDoubleIterable
-
collect
Description copied from interface:DoubleIterableReturns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.- Specified by:
collectin interfaceDoubleIterable- Specified by:
collectin interfaceDoubleList- Specified by:
collectin interfaceMutableDoubleCollection- Specified by:
collectin interfaceMutableDoubleList- Specified by:
collectin interfaceOrderedDoubleIterable- Specified by:
collectin interfaceReversibleDoubleIterable
-
collect
public <V,R extends Collection<V>> R collect(DoubleToObjectFunction<? extends V> function, R target) Description copied from interface:DoubleIterableSame asDoubleIterable.collect(DoubleToObjectFunction), only the results are added to the target Collection.- Specified by:
collectin interfaceDoubleIterable- Since:
- 8.1.
-
max
public double max()- Specified by:
maxin interfaceDoubleIterable
-
min
public double min()- Specified by:
minin interfaceDoubleIterable
-
sum
public double sum()- Specified by:
sumin interfaceDoubleIterable
-
dotProduct
- Specified by:
dotProductin interfaceDoubleList
-
toArray
public double[] toArray()Description copied from interface:DoubleIterableConverts the DoubleIterable to a primitive double array.- Specified by:
toArrayin interfaceDoubleIterable
-
toArray
public double[] toArray(double[] target) Description copied from interface:DoubleIterableConverts the DoubleIterable to a primitive double array. If the collection fits into the provided array it is used to store its elements and is returned from the method, otherwise a new array of the appropriate size is allocated and returned. If the iterable is empty, the target array is returned unchanged.- Specified by:
toArrayin interfaceDoubleIterable
-
equals
Description copied from interface:DoubleListFollows the same general contract asList.equals(Object).- Specified by:
equalsin interfaceDoubleList- Overrides:
equalsin classObject
-
hashCode
public int hashCode()Description copied from interface:DoubleListFollows the same general contract asList.hashCode().- Specified by:
hashCodein interfaceDoubleList- Overrides:
hashCodein classObject
-
appendString
Description copied from interface:PrimitiveIterablePrints a string representation of this collection onto the givenAppendable. Prints the string returned byPrimitiveIterable.makeString(String, String, String).- Specified by:
appendStringin interfacePrimitiveIterable
-
asUnmodifiable
- Specified by:
asUnmodifiablein interfaceMutableDoubleCollection- Specified by:
asUnmodifiablein interfaceMutableDoubleList
-
asSynchronized
- Specified by:
asSynchronizedin interfaceMutableDoubleCollection- Specified by:
asSynchronizedin interfaceMutableDoubleList
-
toImmutable
Description copied from interface:MutableDoubleListReturns an immutable copy of this list.- Specified by:
toImmutablein interfaceDoubleList- Specified by:
toImmutablein interfaceMutableDoubleCollection- Specified by:
toImmutablein interfaceMutableDoubleList
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-
asReversed
- Specified by:
asReversedin interfaceReversibleDoubleIterable
-
reverseThis
- Specified by:
reverseThisin interfaceMutableDoubleList
-
sortThis
Description copied from interface:MutableDoubleListSorts this list mutating its contents and returns the same mutable list (this).- Specified by:
sortThisin interfaceMutableDoubleList
-
sortThis
Description copied from interface:MutableDoubleListSorts the internal data structure of this list and returns the list itself as a convenience.- Specified by:
sortThisin interfaceMutableDoubleList
-
toReversed
- Specified by:
toReversedin interfaceDoubleList- Specified by:
toReversedin interfaceMutableDoubleList- Specified by:
toReversedin interfaceReversibleDoubleIterable
-
binarySearch
public int binarySearch(double value) - Specified by:
binarySearchin interfaceDoubleList
-
distinct
- Specified by:
distinctin interfaceDoubleList- Specified by:
distinctin interfaceMutableDoubleList- Specified by:
distinctin interfaceReversibleDoubleIterable
-
subList
- Specified by:
subListin interfaceDoubleList- Specified by:
subListin interfaceMutableDoubleList- See Also:
-
zipDouble
Description copied from interface:MutableDoubleListReturns aMutableListformed from thisMutableDoubleListand anotherDoubleListby combining corresponding elements in pairs. If one of the twoDoubleLists is longer than the other, its remaining elements are ignored.- Specified by:
zipDoublein interfaceDoubleList- Specified by:
zipDoublein interfaceMutableDoubleList- Since:
- 9.1.
-
newEmpty
Creates a new empty DoubleArrayList.- Specified by:
newEmptyin interfaceMutableDoubleCollection- Specified by:
newEmptyin interfaceMutableDoubleList- Since:
- 9.2.
-
zip
Description copied from interface:MutableDoubleListReturns aMutableListformed from thisMutableDoubleListand aListIterableby combining corresponding elements in pairs. If one of the two Lists is longer than the other, its remaining elements are ignored.- Specified by:
zipin interfaceDoubleList- Specified by:
zipin interfaceMutableDoubleList- Since:
- 9.1.
-
spliterator
- Specified by:
spliteratorin interfaceDoubleList
-