Top Description Methods
org.eclipse.collections.api

public Interface DoubleIterable

extends PrimitiveIterable
Known Direct Subinterfaces
org.eclipse.collections.api.LazyDoubleIterable, org.eclipse.collections.api.bag.primitive.DoubleBag, org.eclipse.collections.api.collection.primitive.ImmutableDoubleCollection, org.eclipse.collections.api.collection.primitive.MutableDoubleCollection, org.eclipse.collections.api.map.primitive.ObjectDoubleMap, org.eclipse.collections.api.map.primitive.DoubleValuesMap, org.eclipse.collections.api.ordered.primitive.OrderedDoubleIterable, org.eclipse.collections.api.set.primitive.DoubleSet
Imports
java.util.Collection, .NoSuchElementException, .DoubleSummaryStatistics, .Comparator, org.eclipse.collections.api.block.comparator.primitive.DoubleComparator, org.eclipse.collections.api.bag.primitive.MutableDoubleBag, org.eclipse.collections.api.block.function.primitive.DoubleToBooleanFunction, .DoubleToByteFunction, .DoubleToShortFunction, .DoubleToCharFunction, .DoubleToDoubleFunction, .DoubleToFloatFunction, .DoubleToIntFunction, .DoubleToLongFunction, .DoubleToObjectFunction, .BooleanDoubleToBooleanFunction, .ByteDoubleToByteFunction, .CharDoubleToCharFunction, .DoubleDoubleToDoubleFunction, .FloatDoubleToFloatFunction, .IntDoubleToIntFunction, .LongDoubleToLongFunction, .ObjectDoubleToObjectFunction, .ShortDoubleToShortFunction, org.eclipse.collections.api.block.predicate.primitive.DoublePredicate, org.eclipse.collections.api.block.procedure.primitive.DoubleProcedure, org.eclipse.collections.api.collection.primitive.MutableBooleanCollection, .MutableByteCollection, .MutableCharCollection, .MutableDoubleCollection, .MutableFloatCollection, .MutableIntCollection, .MutableLongCollection, .MutableShortCollection, org.eclipse.collections.api.iterator.DoubleIterator, org.eclipse.collections.api.list.primitive.MutableDoubleList, org.eclipse.collections.api.set.primitive.DoubleSet, .MutableDoubleSet

DoubleIterable is an interface which is memory-optimized for double primitives. It is inspired by the interface RichIterable, and contains a subset of the internal iterator methods on RichIterable like collect, sum, etc. The API also includes an external iterator method, which returns an DoubleIterator. DoubleIterator helps iterate over the DoubleIterable without boxing the primitives. This file was automatically generated from template file primitiveIterable.stg.

Method Summary

Modifier and TypeMethod and Description
public boolean
allSatisfy(DoublePredicate predicate)

Returns true if all of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.

public boolean
anySatisfy(DoublePredicate predicate)

Returns true if any of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.

public LazyDoubleIterable
asLazy()

Returns a LazyDoubleIterable adapter wrapping the source DoubleIterable.

public double
public default double
averageIfEmpty(double defaultValue)

public default RichIterable<DoubleIterable>

Returns:

A RichIterable containing DoubleIterables of size size, except the last will be truncated if the elements don't divide evenly.
chunk
(int
the number of elements per chunk
size
)

Partitions elements in fixed size chunks.

public <V> RichIterable<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.

public default <V, R extends Collection<V>> R
collect(DoubleToObjectFunction<? extends V> function, R target)

Same as collect(DoubleToObjectFunction) , only the results are added to the target Collection.

public default <R extends MutableBooleanCollection> R
collectBoolean(DoubleToBooleanFunction function, R target)

Returns the target MutableBooleanCollection with the results of applying the specified function on each element of the source collection.

public default <R extends MutableByteCollection> R
collectByte(DoubleToByteFunction function, R target)

Returns the target MutableByteCollection with the results of applying the specified function on each element of the source collection.

public default <R extends MutableCharCollection> R
collectChar(DoubleToCharFunction function, R target)

Returns the target MutableCharCollection with the results of applying the specified function on each element of the source collection.

public default <R extends MutableDoubleCollection> R
collectDouble(DoubleToDoubleFunction function, R target)

Returns the target MutableDoubleCollection with the results of applying the specified function on each element of the source collection.

public default <R extends MutableFloatCollection> R
collectFloat(DoubleToFloatFunction function, R target)

Returns the target MutableFloatCollection with the results of applying the specified function on each element of the source collection.

public default <R extends MutableIntCollection> R
collectInt(DoubleToIntFunction function, R target)

Returns the target MutableIntCollection with the results of applying the specified function on each element of the source collection.

public default <R extends MutableLongCollection> R
collectLong(DoubleToLongFunction function, R target)

Returns the target MutableLongCollection with the results of applying the specified function on each element of the source collection.

public default <R extends MutableShortCollection> R
collectShort(DoubleToShortFunction function, R target)

Returns the target MutableShortCollection with the results of applying the specified function on each element of the source collection.

public boolean
contains(double value)

Returns true if the value is contained in the DoubleIterable, and false if it is not.

public default boolean
containsAll(double... source)

Returns true if all of the values specified in the source array are contained in the DoubleIterable, and false if they are not.

public default boolean
containsAll(DoubleIterable source)

Returns true if all of the values specified in the source DoubleIterable are contained in the DoubleIterable, and false if they are not.

public default boolean
containsAny(double... source)

Returns true if any of the values specified in the source array are contained in the DoubleIterable, and false if they are not.

public default boolean
containsAny(DoubleIterable source)

Returns true if any of the values specified in the source DoubleIterable are contained in the DoubleIterable, and false if they are not.

public default boolean
containsNone(double... source)

Returns true if none of the values specified in the source array are contained in the DoubleIterable, and false if they are.

public default boolean
containsNone(DoubleIterable source)

Returns true if none of the values specified in the source DoubleIterable are contained in the DoubleIterable, and false if they are.

public int
count(DoublePredicate predicate)

Returns a count of the number of elements in the DoubleIterable that return true for the specified predicate.

public double
detectIfNone(DoublePredicate predicate, double ifNone)

public DoubleIterator
doubleIterator()

Returns a primitive iterator that can be used to iterate over the DoubleIterable in an imperative style.

public void
each(DoubleProcedure procedure)

A synonym for forEach.

public default <V, R extends Collection<V>> R
flatCollect(DoubleToObjectFunction<? extends Iterable<V>> function, R target)

flatCollect is a special case of collect(DoubleToObjectFunction).

public default void
forEach(DoubleProcedure procedure)

Applies the DoubleProcedure to each element in the DoubleIterable.

public <T> T
injectInto(T injectedValue, ObjectDoubleToObjectFunction<? super T, ? extends T> function)

public default boolean
injectIntoBoolean(boolean injectedValue, BooleanDoubleToBooleanFunction function)

Returns the final boolean result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public default byte
injectIntoByte(byte injectedValue, ByteDoubleToByteFunction function)

Returns the final byte result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public default char
injectIntoChar(char injectedValue, CharDoubleToCharFunction function)

Returns the final char result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public default double
injectIntoDouble(double injectedValue, DoubleDoubleToDoubleFunction function)

Returns the final double result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public default float
injectIntoFloat(float injectedValue, FloatDoubleToFloatFunction function)

Returns the final float result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public default int
injectIntoInt(int injectedValue, IntDoubleToIntFunction function)

Returns the final int result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public default long
injectIntoLong(long injectedValue, LongDoubleToLongFunction function)

Returns the final long result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public default short
injectIntoShort(short injectedValue, ShortDoubleToShortFunction function)

Returns the final short result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public double
max()

public double
maxIfEmpty(double defaultValue)

public double
public default double
medianIfEmpty(double defaultValue)

public double
min()

public double
minIfEmpty(double defaultValue)

public default boolean
noneSatisfy(DoublePredicate predicate)

Returns true if none of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.

public default double
public default double
reduceIfEmpty(DoubleDoubleToDoubleFunction accumulator, double defaultValue)

public DoubleIterable
reject(DoublePredicate predicate)

Returns a new DoubleIterable with all of the elements in the DoubleIterable that return false for the specified predicate.

public default <R extends MutableDoubleCollection> R
reject(DoublePredicate predicate, R target)

Same as reject(DoublePredicate) , only the results are added to the target MutableDoubleCollection.

public DoubleIterable
select(DoublePredicate predicate)

Returns a new DoubleIterable with all of the elements in the DoubleIterable that return true for the specified predicate.

public default <R extends MutableDoubleCollection> R
select(DoublePredicate predicate, R target)

Same as select(DoublePredicate) , only the results are added to the target MutableDoubleCollection.

public double
sum()

public default DoubleSummaryStatistics
public default DoubleIterable
tap(DoubleProcedure procedure)

public double[]
toArray()

Converts the DoubleIterable to a primitive double array.

public default double[]
toArray(double[] target)

Converts the DoubleIterable to a primitive double array.

public MutableDoubleBag
toBag()

Converts the DoubleIterable to a new MutableDoubleBag.

public MutableDoubleList
toList()

Converts the DoubleIterable to a new MutableDoubleList.

public MutableDoubleSet
toSet()

Converts the DoubleIterable to a new MutableDoubleSet.

public double[]
public MutableDoubleList
public default MutableDoubleList
toSortedList(DoubleComparator comparator)

Converts the collection to a MutableDoubleList implementation sorted using the provided comparator.

public default <T> MutableDoubleList
toSortedListBy(DoubleToObjectFunction<T> function)

Converts the collection to a MutableDoubleListImplementation sorted based on the natural order of the key returned by function.

public default <T> MutableDoubleList
toSortedListBy(DoubleToObjectFunction<T> function, Comparator<? super T> comparator)

Converts the collection to a MutableDoubleList implementation, which is sorted based on the key returned by function using the provided comparator.

Inherited from org.eclipse.collections.api.PrimitiveIterable:
appendStringappendStringappendStringisEmptymakeStringmakeStringmakeStringnotEmptysizetoString

Method Detail

allSatisfyback to summary
public boolean allSatisfy(DoublePredicate predicate)

Returns true if all of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.

anySatisfyback to summary
public boolean anySatisfy(DoublePredicate predicate)

Returns true if any of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.

asLazyback to summary
public LazyDoubleIterable asLazy()

Returns a LazyDoubleIterable adapter wrapping the source DoubleIterable.

averageback to summary
public double average()
averageIfEmptyback to summary
public default double averageIfEmpty(double defaultValue)
Since
9.0
chunkback to summary
public default RichIterable<DoubleIterable> chunk(int size)

Partitions elements in fixed size chunks.

Parameters
size:int

the number of elements per chunk

Returns:RichIterable<DoubleIterable>

A RichIterable containing DoubleIterables of size size, except the last will be truncated if the elements don't divide evenly.

Since
9.2
collectback to summary
public <V> RichIterable<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. This method is also commonly called transform or map.

collectback to summary
public default <V, R extends Collection<V>> R collect(DoubleToObjectFunction<? extends V> function, R target)

Same as collect(DoubleToObjectFunction) , only the results are added to the target Collection.

Since
8.1.
collectBooleanback to summary
public default <R extends MutableBooleanCollection> R collectBoolean(DoubleToBooleanFunction function, R target)

Returns the target MutableBooleanCollection with the results of applying the specified function on each element of the source collection.

Since
8.1.
collectByteback to summary
public default <R extends MutableByteCollection> R collectByte(DoubleToByteFunction function, R target)

Returns the target MutableByteCollection with the results of applying the specified function on each element of the source collection.

Since
8.1.
collectCharback to summary
public default <R extends MutableCharCollection> R collectChar(DoubleToCharFunction function, R target)

Returns the target MutableCharCollection with the results of applying the specified function on each element of the source collection.

Since
8.1.
collectDoubleback to summary
public default <R extends MutableDoubleCollection> R collectDouble(DoubleToDoubleFunction function, R target)

Returns the target MutableDoubleCollection with the results of applying the specified function on each element of the source collection.

Since
8.1.
collectFloatback to summary
public default <R extends MutableFloatCollection> R collectFloat(DoubleToFloatFunction function, R target)

Returns the target MutableFloatCollection with the results of applying the specified function on each element of the source collection.

Since
8.1.
collectIntback to summary
public default <R extends MutableIntCollection> R collectInt(DoubleToIntFunction function, R target)

Returns the target MutableIntCollection with the results of applying the specified function on each element of the source collection.

Since
8.1.
collectLongback to summary
public default <R extends MutableLongCollection> R collectLong(DoubleToLongFunction function, R target)

Returns the target MutableLongCollection with the results of applying the specified function on each element of the source collection.

Since
8.1.
collectShortback to summary
public default <R extends MutableShortCollection> R collectShort(DoubleToShortFunction function, R target)

Returns the target MutableShortCollection with the results of applying the specified function on each element of the source collection.

Since
8.1.
containsback to summary
public boolean contains(double value)

Returns true if the value is contained in the DoubleIterable, and false if it is not.

containsAllback to summary
public default boolean containsAll(double... source)

Returns true if all of the values specified in the source array are contained in the DoubleIterable, and false if they are not.

containsAllback to summary
public default boolean containsAll(DoubleIterable source)

Returns true if all of the values specified in the source DoubleIterable are contained in the DoubleIterable, and false if they are not.

containsAnyback to summary
public default boolean containsAny(double... source)

Returns true if any of the values specified in the source array are contained in the DoubleIterable, and false if they are not.

Since
11.0
containsAnyback to summary
public default boolean containsAny(DoubleIterable source)

Returns true if any of the values specified in the source DoubleIterable are contained in the DoubleIterable, and false if they are not.

Since
11.0
containsNoneback to summary
public default boolean containsNone(double... source)

Returns true if none of the values specified in the source array are contained in the DoubleIterable, and false if they are.

Since
11.0
containsNoneback to summary
public default boolean containsNone(DoubleIterable source)

Returns true if none of the values specified in the source DoubleIterable are contained in the DoubleIterable, and false if they are.

Since
11.0
countback to summary
public int count(DoublePredicate predicate)

Returns a count of the number of elements in the DoubleIterable that return true for the specified predicate.

detectIfNoneback to summary
public double detectIfNone(DoublePredicate predicate, double ifNone)
doubleIteratorback to summary
public DoubleIterator doubleIterator()

Returns a primitive iterator that can be used to iterate over the DoubleIterable in an imperative style.

eachback to summary
public void each(DoubleProcedure procedure)

A synonym for forEach.

Since
7.0.
flatCollectback to summary
public default <V, R extends Collection<V>> R flatCollect(DoubleToObjectFunction<? extends Iterable<V>> function, R target)

flatCollect is a special case of collect(DoubleToObjectFunction). With collect, when the DoubleToObjectFunction returns a collection, the result is a collection of collections. flatCollect outputs a single "flattened" collection instead. This method is commonly called flatMap.

Since
8.1.
forEachback to summary
public default void forEach(DoubleProcedure procedure)

Applies the DoubleProcedure to each element in the DoubleIterable.

injectIntoback to summary
public <T> T injectInto(T injectedValue, ObjectDoubleToObjectFunction<? super T, ? extends T> function)
injectIntoBooleanback to summary
public default boolean injectIntoBoolean(boolean injectedValue, BooleanDoubleToBooleanFunction function)

Returns the final boolean result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.

Since
11.1
injectIntoByteback to summary
public default byte injectIntoByte(byte injectedValue, ByteDoubleToByteFunction function)

Returns the final byte result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.

Since
11.1
injectIntoCharback to summary
public default char injectIntoChar(char injectedValue, CharDoubleToCharFunction function)

Returns the final char result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.

Since
11.1
injectIntoDoubleback to summary
public default double injectIntoDouble(double injectedValue, DoubleDoubleToDoubleFunction function)

Returns the final double result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.

Since
11.1
injectIntoFloatback to summary
public default float injectIntoFloat(float injectedValue, FloatDoubleToFloatFunction function)

Returns the final float result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.

Since
11.1
injectIntoIntback to summary
public default int injectIntoInt(int injectedValue, IntDoubleToIntFunction function)

Returns the final int result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.

Since
11.1
injectIntoLongback to summary
public default long injectIntoLong(long injectedValue, LongDoubleToLongFunction function)

Returns the final long result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.

Since
11.1
injectIntoShortback to summary
public default short injectIntoShort(short injectedValue, ShortDoubleToShortFunction function)

Returns the final short result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.

Since
11.1
maxback to summary
public double max()
maxIfEmptyback to summary
public double maxIfEmpty(double defaultValue)
medianback to summary
public double median()
medianIfEmptyback to summary
public default double medianIfEmpty(double defaultValue)
Since
9.0
minback to summary
public double min()
minIfEmptyback to summary
public double minIfEmpty(double defaultValue)
noneSatisfyback to summary
public default boolean noneSatisfy(DoublePredicate predicate)

Returns true if none of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.

reduceback to summary
public default double reduce(DoubleDoubleToDoubleFunction accumulator)
Since
10.0
See Also
RichIterable#reduce(BinaryOperator)
reduceIfEmptyback to summary
public default double reduceIfEmpty(DoubleDoubleToDoubleFunction accumulator, double defaultValue)
Since
10.0
See Also
reduce(DoubleDoubleToDoubleFunction)
rejectback to summary
public DoubleIterable reject(DoublePredicate predicate)

Returns a new DoubleIterable with all of the elements in the DoubleIterable that return false for the specified predicate.

rejectback to summary
public default <R extends MutableDoubleCollection> R reject(DoublePredicate predicate, R target)

Same as reject(DoublePredicate) , only the results are added to the target MutableDoubleCollection.

Since
8.1.
selectback to summary
public DoubleIterable select(DoublePredicate predicate)

Returns a new DoubleIterable with all of the elements in the DoubleIterable that return true for the specified predicate.

selectback to summary
public default <R extends MutableDoubleCollection> R select(DoublePredicate predicate, R target)

Same as select(DoublePredicate) , only the results are added to the target MutableDoubleCollection.

Since
8.1.
sumback to summary
public double sum()
summaryStatisticsback to summary
public default DoubleSummaryStatistics summaryStatistics()
Since
8.0
tapback to summary
public default DoubleIterable tap(DoubleProcedure procedure)
Since
9.0.
toArrayback to summary
public double[] toArray()

Converts the DoubleIterable to a primitive double array.

toArrayback to summary
public default double[] toArray(double[] target)

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.

toBagback to summary
public MutableDoubleBag toBag()

Converts the DoubleIterable to a new MutableDoubleBag.

toListback to summary
public MutableDoubleList toList()

Converts the DoubleIterable to a new MutableDoubleList.

toSetback to summary
public MutableDoubleSet toSet()

Converts the DoubleIterable to a new MutableDoubleSet.

toSortedArrayback to summary
public double[] toSortedArray()
toSortedListback to summary
public MutableDoubleList toSortedList()
toSortedListback to summary
public default MutableDoubleList toSortedList(DoubleComparator comparator)

Converts the collection to a MutableDoubleList implementation sorted using the provided comparator.

toSortedListByback to summary
public default <T> MutableDoubleList toSortedListBy(DoubleToObjectFunction<T> function)

Converts the collection to a MutableDoubleListImplementation sorted based on the natural order of the key returned by function.

toSortedListByback to summary
public default <T> MutableDoubleList toSortedListBy(DoubleToObjectFunction<T> function, Comparator<? super T> comparator)

Converts the collection to a MutableDoubleList implementation, which is sorted based on the key returned by function using the provided comparator.