Top Description Methods
org.eclipse.collections.api

public Interface FloatIterable

extends PrimitiveIterable
Known Direct Subinterfaces
org.eclipse.collections.api.LazyFloatIterable, org.eclipse.collections.api.bag.primitive.FloatBag, org.eclipse.collections.api.collection.primitive.ImmutableFloatCollection, org.eclipse.collections.api.collection.primitive.MutableFloatCollection, org.eclipse.collections.api.map.primitive.ObjectFloatMap, org.eclipse.collections.api.map.primitive.FloatValuesMap, org.eclipse.collections.api.ordered.primitive.OrderedFloatIterable, org.eclipse.collections.api.set.primitive.FloatSet
Imports
java.util.Collection, .NoSuchElementException, .DoubleSummaryStatistics, .Comparator, org.eclipse.collections.api.block.comparator.primitive.FloatComparator, org.eclipse.collections.api.bag.primitive.MutableFloatBag, org.eclipse.collections.api.block.function.primitive.FloatToBooleanFunction, .FloatToByteFunction, .FloatToShortFunction, .FloatToCharFunction, .FloatToDoubleFunction, .FloatToFloatFunction, .FloatToIntFunction, .FloatToLongFunction, .FloatToObjectFunction, .BooleanFloatToBooleanFunction, .ByteFloatToByteFunction, .CharFloatToCharFunction, .DoubleFloatToDoubleFunction, .FloatFloatToFloatFunction, .IntFloatToIntFunction, .LongFloatToLongFunction, .ObjectFloatToObjectFunction, .ShortFloatToShortFunction, org.eclipse.collections.api.block.predicate.primitive.FloatPredicate, org.eclipse.collections.api.block.procedure.primitive.FloatProcedure, org.eclipse.collections.api.collection.primitive.MutableBooleanCollection, .MutableByteCollection, .MutableCharCollection, .MutableDoubleCollection, .MutableFloatCollection, .MutableIntCollection, .MutableLongCollection, .MutableShortCollection, org.eclipse.collections.api.iterator.FloatIterator, org.eclipse.collections.api.list.primitive.MutableFloatList, org.eclipse.collections.api.set.primitive.FloatSet, .MutableFloatSet

FloatIterable is an interface which is memory-optimized for float 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 FloatIterator. FloatIterator helps iterate over the FloatIterable without boxing the primitives. This file was automatically generated from template file primitiveIterable.stg.

Method Summary

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

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

public boolean
anySatisfy(FloatPredicate predicate)

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

public LazyFloatIterable
asLazy()

Returns a LazyFloatIterable adapter wrapping the source FloatIterable.

public double
public default double
averageIfEmpty(double defaultValue)

public default RichIterable<FloatIterable>

Returns:

A RichIterable containing FloatIterables 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(FloatToObjectFunction<? 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(FloatToObjectFunction<? extends V> function, R target)

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

public default <R extends MutableBooleanCollection> R
collectBoolean(FloatToBooleanFunction 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(FloatToByteFunction 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(FloatToCharFunction 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(FloatToDoubleFunction 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(FloatToFloatFunction 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(FloatToIntFunction 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(FloatToLongFunction 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(FloatToShortFunction 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(float value)

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

public default boolean
containsAll(float... source)

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

public default boolean
containsAll(FloatIterable source)

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

public default boolean
containsAny(float... source)

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

public default boolean
containsAny(FloatIterable source)

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

public default boolean
containsNone(float... source)

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

public default boolean
containsNone(FloatIterable source)

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

public int
count(FloatPredicate predicate)

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

public float
detectIfNone(FloatPredicate predicate, float ifNone)

public void
each(FloatProcedure procedure)

A synonym for forEach.

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

flatCollect is a special case of collect(FloatToObjectFunction).

public FloatIterator
floatIterator()

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

public default void
forEach(FloatProcedure procedure)

Applies the FloatProcedure to each element in the FloatIterable.

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

public default boolean
injectIntoBoolean(boolean injectedValue, BooleanFloatToBooleanFunction 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, ByteFloatToByteFunction 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, CharFloatToCharFunction 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, DoubleFloatToDoubleFunction 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, FloatFloatToFloatFunction 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, IntFloatToIntFunction 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, LongFloatToLongFunction 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, ShortFloatToShortFunction function)

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

public float
max()

public float
maxIfEmpty(float defaultValue)

public double
public default double
medianIfEmpty(double defaultValue)

public float
min()

public float
minIfEmpty(float defaultValue)

public default boolean
noneSatisfy(FloatPredicate predicate)

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

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

public FloatIterable
reject(FloatPredicate predicate)

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

public default <R extends MutableFloatCollection> R
reject(FloatPredicate predicate, R target)

Same as reject(FloatPredicate) , only the results are added to the target MutableFloatCollection.

public FloatIterable
select(FloatPredicate predicate)

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

public default <R extends MutableFloatCollection> R
select(FloatPredicate predicate, R target)

Same as select(FloatPredicate) , only the results are added to the target MutableFloatCollection.

public double
sum()

public default DoubleSummaryStatistics
public default FloatIterable
tap(FloatProcedure procedure)

public float[]
toArray()

Converts the FloatIterable to a primitive float array.

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

Converts the FloatIterable to a primitive float array.

public MutableFloatBag
toBag()

Converts the FloatIterable to a new MutableFloatBag.

public MutableFloatList
toList()

Converts the FloatIterable to a new MutableFloatList.

public MutableFloatSet
toSet()

Converts the FloatIterable to a new MutableFloatSet.

public float[]
public MutableFloatList
public default MutableFloatList
toSortedList(FloatComparator comparator)

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

public default <T> MutableFloatList
toSortedListBy(FloatToObjectFunction<T> function)

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

public default <T> MutableFloatList
toSortedListBy(FloatToObjectFunction<T> function, Comparator<? super T> comparator)

Converts the collection to a MutableFloatList 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(FloatPredicate predicate)

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

anySatisfyback to summary
public boolean anySatisfy(FloatPredicate predicate)

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

asLazyback to summary
public LazyFloatIterable asLazy()

Returns a LazyFloatIterable adapter wrapping the source FloatIterable.

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

Partitions elements in fixed size chunks.

Parameters
size:int

the number of elements per chunk

Returns:RichIterable<FloatIterable>

A RichIterable containing FloatIterables 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(FloatToObjectFunction<? 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(FloatToObjectFunction<? extends V> function, R target)

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

Since
8.1.
collectBooleanback to summary
public default <R extends MutableBooleanCollection> R collectBoolean(FloatToBooleanFunction 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(FloatToByteFunction 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(FloatToCharFunction 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(FloatToDoubleFunction 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(FloatToFloatFunction 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(FloatToIntFunction 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(FloatToLongFunction 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(FloatToShortFunction 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(float value)

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

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

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

containsAllback to summary
public default boolean containsAll(FloatIterable source)

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

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

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

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

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

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

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

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

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

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

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

detectIfNoneback to summary
public float detectIfNone(FloatPredicate predicate, float ifNone)
eachback to summary
public void each(FloatProcedure procedure)

A synonym for forEach.

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

flatCollect is a special case of collect(FloatToObjectFunction). With collect, when the FloatToObjectFunction 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.
floatIteratorback to summary
public FloatIterator floatIterator()

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

forEachback to summary
public default void forEach(FloatProcedure procedure)

Applies the FloatProcedure to each element in the FloatIterable.

injectIntoback to summary
public <T> T injectInto(T injectedValue, ObjectFloatToObjectFunction<? super T, ? extends T> function)
injectIntoBooleanback to summary
public default boolean injectIntoBoolean(boolean injectedValue, BooleanFloatToBooleanFunction 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, ByteFloatToByteFunction 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, CharFloatToCharFunction 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, DoubleFloatToDoubleFunction 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, FloatFloatToFloatFunction 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, IntFloatToIntFunction 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, LongFloatToLongFunction 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, ShortFloatToShortFunction 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 float max()
maxIfEmptyback to summary
public float maxIfEmpty(float defaultValue)
medianback to summary
public double median()
medianIfEmptyback to summary
public default double medianIfEmpty(double defaultValue)
Since
9.0
minback to summary
public float min()
minIfEmptyback to summary
public float minIfEmpty(float defaultValue)
noneSatisfyback to summary
public default boolean noneSatisfy(FloatPredicate predicate)

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

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

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

rejectback to summary
public default <R extends MutableFloatCollection> R reject(FloatPredicate predicate, R target)

Same as reject(FloatPredicate) , only the results are added to the target MutableFloatCollection.

Since
8.1.
selectback to summary
public FloatIterable select(FloatPredicate predicate)

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

selectback to summary
public default <R extends MutableFloatCollection> R select(FloatPredicate predicate, R target)

Same as select(FloatPredicate) , only the results are added to the target MutableFloatCollection.

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

Converts the FloatIterable to a primitive float array.

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

Converts the FloatIterable to a primitive float 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 MutableFloatBag toBag()

Converts the FloatIterable to a new MutableFloatBag.

toListback to summary
public MutableFloatList toList()

Converts the FloatIterable to a new MutableFloatList.

toSetback to summary
public MutableFloatSet toSet()

Converts the FloatIterable to a new MutableFloatSet.

toSortedArrayback to summary
public float[] toSortedArray()
toSortedListback to summary
public MutableFloatList toSortedList()
toSortedListback to summary
public default MutableFloatList toSortedList(FloatComparator comparator)

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

toSortedListByback to summary
public default <T> MutableFloatList toSortedListBy(FloatToObjectFunction<T> function)

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

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

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