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:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description DoubleArrayList()
DoubleArrayList(double... array)
DoubleArrayList(int initialCapacity)
-
Method Summary
Modifier and Type Method Description boolean
add(double newItem)
boolean
addAll(double... source)
boolean
addAll(DoubleIterable source)
boolean
addAllAtIndex(int index, double... source)
boolean
addAllAtIndex(int index, DoubleIterable source)
void
addAtIndex(int index, double element)
boolean
allSatisfy(DoublePredicate predicate)
Returns true if all of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.boolean
anySatisfy(DoublePredicate predicate)
Returns true if any of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.void
appendString(Appendable appendable, String start, String separator, String end)
Prints a string representation of this collection onto the givenAppendable
.LazyDoubleIterable
asReversed()
MutableDoubleList
asSynchronized()
MutableDoubleList
asUnmodifiable()
int
binarySearch(double value)
RichIterable<DoubleIterable>
chunk(int size)
Partitions elements in fixed size chunks.void
clear()
<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.boolean
contains(double value)
Returns true if the value is contained in the DoubleIterable, and false if it is not.int
count(DoublePredicate predicate)
Returns a count of the number of elements in the DoubleIterable that return true for the specified predicate.double
detectIfNone(DoublePredicate predicate, double ifNone)
MutableDoubleList
distinct()
double
dotProduct(DoubleList list)
MutableDoubleIterator
doubleIterator()
Returns a primitive iterator that can be used to iterate over the DoubleIterable in an imperative style.void
each(DoubleProcedure procedure)
A synonym for forEach.void
ensureCapacity(int minCapacity)
boolean
equals(Object otherList)
Follows the same general contract asList.equals(Object)
.void
forEach(DoubleProcedure procedure)
Applies the DoubleProcedure to each element in the DoubleIterable.void
forEachWithIndex(DoubleIntProcedure procedure)
double
get(int index)
double
getFirst()
double
getLast()
int
hashCode()
Follows the same general contract asList.hashCode()
.int
indexOf(double value)
<T> T
injectInto(T injectedValue, ObjectDoubleToObjectFunction<? super T,? extends T> function)
<T> T
injectIntoWithIndex(T injectedValue, ObjectDoubleIntToObjectFunction<? super T,? extends T> function)
int
lastIndexOf(double value)
double
max()
double
min()
DoubleArrayList
newEmpty()
Creates a new empty DoubleArrayList.static DoubleArrayList
newList(DoubleIterable source)
static DoubleArrayList
newListWith(double... elements)
Creates a new list using the passedelements
argument as the backing store.static DoubleArrayList
newWithNValues(int size, double value)
boolean
noneSatisfy(DoublePredicate predicate)
Returns true if none of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.void
readExternal(ObjectInput in)
DoubleArrayList
reject(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.boolean
remove(double value)
boolean
removeAll(double... source)
boolean
removeAll(DoubleIterable source)
double
removeAtIndex(int index)
boolean
removeIf(DoublePredicate predicate)
boolean
retainAll(double... source)
boolean
retainAll(DoubleIterable source)
DoubleArrayList
reverseThis()
DoubleArrayList
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.double
set(int index, double element)
int
size()
Returns the number of items in this iterable.DoubleArrayList
sortThis()
Sorts this list mutating its contents and returns the same mutable list (this).DoubleArrayList
sortThis(DoubleComparator comparator)
Sorts the internal data structure of this list and returns the list itself as a convenience.Spliterator.OfDouble
spliterator()
MutableDoubleList
subList(int fromIndex, int toIndex)
double
sum()
void
swap(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.ImmutableDoubleList
toImmutable()
Returns an immutable copy of this list.DoubleArrayList
toReversed()
void
trimToSize()
DoubleArrayList
with(double element)
DoubleArrayList
with(double element1, double element2)
DoubleArrayList
with(double element1, double element2, double element3)
DoubleArrayList
with(double element1, double element2, double element3, double... elements)
DoubleArrayList
withAll(DoubleIterable elements)
DoubleArrayList
without(double element)
DoubleArrayList
withoutAll(DoubleIterable elements)
static DoubleArrayList
wrapCopy(double... array)
Creates a new list by first copying the array passed in.void
writeExternal(ObjectOutput out)
<T> MutableList<DoubleObjectPair<T>>
zip(Iterable<T> iterable)
Returns aMutableList
formed from thisMutableDoubleList
and aListIterable
by combining corresponding elements in pairs.MutableList<DoubleDoublePair>
zipDouble(DoubleIterable iterable)
Returns aMutableList
formed from thisMutableDoubleList
and anotherDoubleList
by combining corresponding elements in pairs.Methods inherited from class org.eclipse.collections.impl.primitive.AbstractDoubleIterable
asLazy, average, containsAll, containsAll, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toString
Methods inherited from interface org.eclipse.collections.api.DoubleIterable
asLazy, average, averageIfEmpty, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAll, containsAll, flatCollect, maxIfEmpty, median, medianIfEmpty, minIfEmpty, reduce, reduceIfEmpty, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedList
Methods inherited from interface org.eclipse.collections.api.list.primitive.DoubleList
primitiveParallelStream, primitiveStream
Methods inherited from interface org.eclipse.collections.api.list.primitive.MutableDoubleList
collectWithIndex, shuffleThis, shuffleThis, sortThisBy, sortThisBy, tap
Methods inherited from interface org.eclipse.collections.api.ordered.primitive.OrderedDoubleIterable
collectWithIndex
Methods 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 passedelements
argument 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:PrimitiveIterable
Returns the number of items in this iterable.- Specified by:
size
in interfacePrimitiveIterable
-
clear
public void clear()- Specified by:
clear
in interfaceMutableDoubleCollection
-
contains
public boolean contains(double value)Description copied from interface:DoubleIterable
Returns true if the value is contained in the DoubleIterable, and false if it is not.- Specified by:
contains
in interfaceDoubleIterable
-
get
public double get(int index)- Specified by:
get
in interfaceDoubleList
-
getFirst
public double getFirst()- Specified by:
getFirst
in interfaceOrderedDoubleIterable
-
getLast
public double getLast()- Specified by:
getLast
in interfaceReversibleDoubleIterable
-
indexOf
public int indexOf(double value)- Specified by:
indexOf
in interfaceOrderedDoubleIterable
-
lastIndexOf
public int lastIndexOf(double value)- Specified by:
lastIndexOf
in interfaceDoubleList
-
trimToSize
public void trimToSize() -
ensureCapacity
public void ensureCapacity(int minCapacity) -
add
public boolean add(double newItem)- Specified by:
add
in interfaceMutableDoubleCollection
-
addAll
public boolean addAll(double... source)- Specified by:
addAll
in interfaceMutableDoubleCollection
-
addAll
- Specified by:
addAll
in interfaceMutableDoubleCollection
-
addAtIndex
public void addAtIndex(int index, double element)- Specified by:
addAtIndex
in interfaceMutableDoubleList
-
addAllAtIndex
public boolean addAllAtIndex(int index, double... source)- Specified by:
addAllAtIndex
in interfaceMutableDoubleList
-
addAllAtIndex
- Specified by:
addAllAtIndex
in interfaceMutableDoubleList
-
remove
public boolean remove(double value)- Specified by:
remove
in interfaceMutableDoubleCollection
-
removeIf
- Specified by:
removeIf
in interfaceMutableDoubleCollection
-
removeAll
- Specified by:
removeAll
in interfaceMutableDoubleCollection
-
removeAll
public boolean removeAll(double... source)- Specified by:
removeAll
in interfaceMutableDoubleCollection
-
retainAll
- Specified by:
retainAll
in interfaceMutableDoubleCollection
- See Also:
Collection.retainAll(Collection)
-
retainAll
public boolean retainAll(double... source)- Specified by:
retainAll
in interfaceMutableDoubleCollection
- See Also:
Collection.retainAll(Collection)
-
removeAtIndex
public double removeAtIndex(int index)- Specified by:
removeAtIndex
in interfaceMutableDoubleList
-
set
public double set(int index, double element)- Specified by:
set
in interfaceMutableDoubleList
-
swap
public void swap(int index1, int index2)- Specified by:
swap
in interfaceMutableDoubleList
-
with
- Specified by:
with
in interfaceMutableDoubleCollection
- Specified by:
with
in interfaceMutableDoubleList
-
without
- Specified by:
without
in interfaceMutableDoubleCollection
- Specified by:
without
in interfaceMutableDoubleList
-
withAll
- Specified by:
withAll
in interfaceMutableDoubleCollection
- Specified by:
withAll
in interfaceMutableDoubleList
-
withoutAll
- Specified by:
withoutAll
in interfaceMutableDoubleCollection
- Specified by:
withoutAll
in interfaceMutableDoubleList
-
with
-
with
-
with
-
doubleIterator
Description copied from interface:DoubleIterable
Returns a primitive iterator that can be used to iterate over the DoubleIterable in an imperative style.- Specified by:
doubleIterator
in interfaceDoubleIterable
- Specified by:
doubleIterator
in interfaceMutableDoubleCollection
-
forEach
Description copied from interface:DoubleIterable
Applies the DoubleProcedure to each element in the DoubleIterable.- Specified by:
forEach
in interfaceDoubleIterable
-
each
Description copied from interface:DoubleIterable
A synonym for forEach.- Specified by:
each
in interfaceDoubleIterable
- Since:
- 7.0.
-
forEachWithIndex
- Specified by:
forEachWithIndex
in interfaceOrderedDoubleIterable
-
injectInto
public <T> T injectInto(T injectedValue, ObjectDoubleToObjectFunction<? super T,? extends T> function)- Specified by:
injectInto
in interfaceDoubleIterable
-
injectIntoWithIndex
public <T> T injectIntoWithIndex(T injectedValue, ObjectDoubleIntToObjectFunction<? super T,? extends T> function)- Specified by:
injectIntoWithIndex
in interfaceOrderedDoubleIterable
- Specified by:
injectIntoWithIndex
in interfaceReversibleDoubleIterable
-
chunk
Description copied from interface:DoubleIterable
Partitions elements in fixed size chunks.- Specified by:
chunk
in interfaceDoubleIterable
- Parameters:
size
- the number of elements per chunk- Returns:
- A
RichIterable
containingDoubleIterable
s of sizesize
, except the last will be truncated if the elements don't divide evenly.
-
count
Description copied from interface:DoubleIterable
Returns a count of the number of elements in the DoubleIterable that return true for the specified predicate.- Specified by:
count
in interfaceDoubleIterable
-
anySatisfy
Description copied from interface:DoubleIterable
Returns true if any of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfy
in interfaceDoubleIterable
-
allSatisfy
Description copied from interface:DoubleIterable
Returns true if all of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfy
in interfaceDoubleIterable
-
noneSatisfy
Description copied from interface:DoubleIterable
Returns true if none of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.- Specified by:
noneSatisfy
in interfaceDoubleIterable
-
select
Description copied from interface:DoubleIterable
Returns a new DoubleIterable with all of the elements in the DoubleIterable that return true for the specified predicate.- Specified by:
select
in interfaceDoubleIterable
- Specified by:
select
in interfaceDoubleList
- Specified by:
select
in interfaceMutableDoubleCollection
- Specified by:
select
in interfaceMutableDoubleList
- Specified by:
select
in interfaceOrderedDoubleIterable
- Specified by:
select
in interfaceReversibleDoubleIterable
-
select
Description copied from interface:DoubleIterable
Same asDoubleIterable.select(DoublePredicate)
, only the results are added to the target MutableDoubleCollection.- Specified by:
select
in interfaceDoubleIterable
- Since:
- 8.1.
-
reject
Description copied from interface:DoubleIterable
Returns a new DoubleIterable with all of the elements in the DoubleIterable that return false for the specified predicate.- Specified by:
reject
in interfaceDoubleIterable
- Specified by:
reject
in interfaceDoubleList
- Specified by:
reject
in interfaceMutableDoubleCollection
- Specified by:
reject
in interfaceMutableDoubleList
- Specified by:
reject
in interfaceOrderedDoubleIterable
- Specified by:
reject
in interfaceReversibleDoubleIterable
-
reject
Description copied from interface:DoubleIterable
Same asDoubleIterable.reject(DoublePredicate)
, only the results are added to the target MutableDoubleCollection.- Specified by:
reject
in interfaceDoubleIterable
- Since:
- 8.1.
-
detectIfNone
- Specified by:
detectIfNone
in interfaceDoubleIterable
-
collect
Description copied from interface:DoubleIterable
Returns 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:
collect
in interfaceDoubleIterable
- Specified by:
collect
in interfaceDoubleList
- Specified by:
collect
in interfaceMutableDoubleCollection
- Specified by:
collect
in interfaceMutableDoubleList
- Specified by:
collect
in interfaceOrderedDoubleIterable
- Specified by:
collect
in interfaceReversibleDoubleIterable
-
collect
public <V, R extends Collection<V>> R collect(DoubleToObjectFunction<? extends V> function, R target)Description copied from interface:DoubleIterable
Same asDoubleIterable.collect(DoubleToObjectFunction)
, only the results are added to the target Collection.- Specified by:
collect
in interfaceDoubleIterable
- Since:
- 8.1.
-
max
public double max()- Specified by:
max
in interfaceDoubleIterable
-
min
public double min()- Specified by:
min
in interfaceDoubleIterable
-
sum
public double sum()- Specified by:
sum
in interfaceDoubleIterable
-
dotProduct
- Specified by:
dotProduct
in interfaceDoubleList
-
toArray
public double[] toArray()Description copied from interface:DoubleIterable
Converts the DoubleIterable to a primitive double array.- Specified by:
toArray
in interfaceDoubleIterable
-
toArray
public double[] toArray(double[] target)Description copied from interface:DoubleIterable
Converts 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:
toArray
in interfaceDoubleIterable
-
equals
Description copied from interface:DoubleList
Follows the same general contract asList.equals(Object)
.- Specified by:
equals
in interfaceDoubleList
- Overrides:
equals
in classObject
-
hashCode
public int hashCode()Description copied from interface:DoubleList
Follows the same general contract asList.hashCode()
.- Specified by:
hashCode
in interfaceDoubleList
- Overrides:
hashCode
in classObject
-
appendString
Description copied from interface:PrimitiveIterable
Prints a string representation of this collection onto the givenAppendable
. Prints the string returned byPrimitiveIterable.makeString(String, String, String)
.- Specified by:
appendString
in interfacePrimitiveIterable
-
asUnmodifiable
- Specified by:
asUnmodifiable
in interfaceMutableDoubleCollection
- Specified by:
asUnmodifiable
in interfaceMutableDoubleList
-
asSynchronized
- Specified by:
asSynchronized
in interfaceMutableDoubleCollection
- Specified by:
asSynchronized
in interfaceMutableDoubleList
-
toImmutable
Description copied from interface:MutableDoubleList
Returns an immutable copy of this list.- Specified by:
toImmutable
in interfaceDoubleList
- Specified by:
toImmutable
in interfaceMutableDoubleCollection
- Specified by:
toImmutable
in interfaceMutableDoubleList
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
-
asReversed
- Specified by:
asReversed
in interfaceReversibleDoubleIterable
-
reverseThis
- Specified by:
reverseThis
in interfaceMutableDoubleList
-
sortThis
Description copied from interface:MutableDoubleList
Sorts this list mutating its contents and returns the same mutable list (this).- Specified by:
sortThis
in interfaceMutableDoubleList
-
sortThis
Description copied from interface:MutableDoubleList
Sorts the internal data structure of this list and returns the list itself as a convenience.- Specified by:
sortThis
in interfaceMutableDoubleList
-
toReversed
- Specified by:
toReversed
in interfaceDoubleList
- Specified by:
toReversed
in interfaceMutableDoubleList
- Specified by:
toReversed
in interfaceReversibleDoubleIterable
-
binarySearch
public int binarySearch(double value)- Specified by:
binarySearch
in interfaceDoubleList
-
distinct
- Specified by:
distinct
in interfaceDoubleList
- Specified by:
distinct
in interfaceMutableDoubleList
- Specified by:
distinct
in interfaceReversibleDoubleIterable
-
subList
- Specified by:
subList
in interfaceDoubleList
- Specified by:
subList
in interfaceMutableDoubleList
- See Also:
List.subList(int fromIndex, int toIndex)
-
zipDouble
Description copied from interface:MutableDoubleList
Returns aMutableList
formed from thisMutableDoubleList
and anotherDoubleList
by combining corresponding elements in pairs. If one of the twoDoubleList
s is longer than the other, its remaining elements are ignored.- Specified by:
zipDouble
in interfaceDoubleList
- Specified by:
zipDouble
in interfaceMutableDoubleList
- Since:
- 9.1.
-
newEmpty
Creates a new empty DoubleArrayList.- Specified by:
newEmpty
in interfaceMutableDoubleCollection
- Specified by:
newEmpty
in interfaceMutableDoubleList
- Since:
- 9.2.
-
zip
Description copied from interface:MutableDoubleList
Returns aMutableList
formed from thisMutableDoubleList
and aListIterable
by combining corresponding elements in pairs. If one of the two Lists is longer than the other, its remaining elements are ignored.- Specified by:
zip
in interfaceDoubleList
- Specified by:
zip
in interfaceMutableDoubleList
- Since:
- 9.1.
-
spliterator
- Specified by:
spliterator
in interfaceDoubleList
-