Top Description Methods
org.eclipse.collections.api

public Interface RichIterable<T>

extends InternalIterable<T>
Known Direct Subinterfaces
org.eclipse.collections.api.bag.Bag, org.eclipse.collections.api.collection.ImmutableCollection, org.eclipse.collections.api.collection.MutableCollection, org.eclipse.collections.api.map.MapIterable, org.eclipse.collections.api.map.primitive.PrimitiveObjectMap, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.set.SetIterable, org.eclipse.collections.api.LazyIterable
Annotations
@SuppressWarnings:ClassReferencesSubclass
Imports
java.lang.reflect.Array, java.util.Collection, .Comparator, .DoubleSummaryStatistics, .IntSummaryStatistics, .LongSummaryStatistics, .Map, .NoSuchElementException, .Objects, .Optional, java.util.function.BiConsumer, .BinaryOperator, .Supplier, java.util.stream.Collector, .Stream, .StreamSupport, org.eclipse.collections.api.bag.Bag, .ImmutableBag, .MutableBag, .MutableBagIterable, org.eclipse.collections.api.bag.sorted.ImmutableSortedBag, .MutableSortedBag, org.eclipse.collections.api.bimap.ImmutableBiMap, .MutableBiMap, org.eclipse.collections.api.block.factory.SerializableComparators, org.eclipse.collections.api.block.function.Function, .Function0, .Function2, org.eclipse.collections.api.block.function.primitive.BooleanFunction, .ByteFunction, .CharFunction, .DoubleFunction, .DoubleObjectToDoubleFunction, .FloatFunction, .FloatObjectToFloatFunction, .IntFunction, .IntObjectToIntFunction, .LongFunction, .LongObjectToLongFunction, .ShortFunction, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.block.procedure.Procedure, .Procedure2, org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure, org.eclipse.collections.api.collection.primitive.MutableBooleanCollection, .MutableByteCollection, .MutableCharCollection, .MutableDoubleCollection, .MutableFloatCollection, .MutableIntCollection, .MutableLongCollection, .MutableShortCollection, org.eclipse.collections.api.factory.Bags, .Lists, .Maps, .Sets, .SortedBags, .SortedSets, org.eclipse.collections.api.list.ImmutableList, .MutableList, org.eclipse.collections.api.map.ImmutableMap, .MapIterable, .MutableMap, .MutableMapIterable, org.eclipse.collections.api.map.primitive.ObjectDoubleMap, .ObjectLongMap, org.eclipse.collections.api.map.sorted.MutableSortedMap, org.eclipse.collections.api.multimap.Multimap, .MutableMultimap, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.partition.PartitionIterable, org.eclipse.collections.api.set.ImmutableSet, .MutableSet, .SetIterable, org.eclipse.collections.api.set.sorted.ImmutableSortedSet, .MutableSortedSet, org.eclipse.collections.api.tuple.Pair

RichIterable is a read-only interface which extends the InternalIterable interface and adds many internal iterator methods. The basic methods were inspired by the Smalltalk Collection protocol. These methods include select, reject, detect, collect, injectInto, anySatisfy, allSatisfy. The API also includes converter methods to convert a RichIterable to other mutable and immutable collection types. The converter methods typically have a prefix of "to" (e.g. toList, toSet, toBag, toMap, etc.).

The methods in RichIterable are organized into the following method categories via region comments which are collapsible in various IDEs. Links are provided below as a convenience to help discover specific methods in Javadoc.

Since
1.0

Method Summary

Modifier and TypeMethod and Description
public default <K, V> MapIterable<K, V>
aggregateBy(Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Function2<? super V, ? super T, ? extends V> nonMutatingAggregator)

Applies an aggregate function over the iterable grouping results into a map based on the specific groupBy function.

public default <K, V, R extends MutableMapIterable<K, V>> R
aggregateBy(Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Function2<? super V, ? super T, ? extends V> nonMutatingAggregator, R target)

Applies an aggregate function over the iterable grouping results into the target map based on the specific groupBy function.

public default <K, V> MapIterable<K, V>
aggregateInPlaceBy(Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Procedure2<? super V, ? super T> mutatingAggregator)

Applies an aggregate procedure over the iterable grouping results into a Map based on the specific groupBy function.

public boolean
allSatisfy(Predicate<? super T> predicate)

Returns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty.

public <P> boolean
allSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Returns true if the predicate evaluates to true for every element of the collection, or returns false.

public boolean
anySatisfy(Predicate<? super T> predicate)

Returns true if the predicate evaluates to true for any element of the iterable.

public <P> boolean
anySatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Returns true if the predicate evaluates to true for any element of the collection, or return false.

public default void
appendString(Appendable appendable)

Prints a string representation of this collection onto the given Appendable.

public default void
appendString(Appendable appendable, String separator)

Prints a string representation of this collection onto the given Appendable.

public void
appendString(Appendable appendable, String start, String separator, String end)

Prints a string representation of this collection onto the given Appendable.

public LazyIterable<T>
asLazy()

Returns a lazy (deferred) iterable, most likely implemented by calling LazyIterate.adapt(this).

public RichIterable<RichIterable<T>>

Returns:

A RichIterable containing RichIterables 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(Function<? super T, ? extends V> function)

Returns a new collection with the results of applying the specified function on each element of the source collection.

public <V, R extends Collection<V>> R

Returns:

target, which contains appended elements as a result of the collect transformation
collect
(Function<? super T, ? extends V>
a Function to use as the collect transformation function
function
,
R
the Collection to append to for all elements in this RichIterable that meet select criteria function
target
)

Same as collect(Function), except that the results are gathered into the specified target collection.

public BooleanIterable
collectBoolean(BooleanFunction<? super T> booleanFunction)

Returns a new primitive boolean iterable with the results of applying the specified function on each element of the source collection.

public default <R extends MutableBooleanCollection> R

Returns:

target, which contains appended elements as a result of the collect transformation
collectBoolean
(BooleanFunction<? super T>
a BooleanFunction to use as the collect transformation function
booleanFunction
,
R
the MutableBooleanCollection to append to for all elements in this RichIterable
target
)

Same as collectBoolean(BooleanFunction), except that the results are gathered into the specified target collection.

public ByteIterable
collectByte(ByteFunction<? super T> byteFunction)

Returns a new primitive byte iterable with the results of applying the specified function on each element of the source collection.

public default <R extends MutableByteCollection> R

Returns:

target, which contains appended elements as a result of the collect transformation
collectByte
(ByteFunction<? super T>
a ByteFunction to use as the collect transformation function
byteFunction
,
R
the MutableByteCollection to append to for all elements in this RichIterable
target
)

Same as collectByte(ByteFunction), except that the results are gathered into the specified target collection.

public CharIterable
collectChar(CharFunction<? super T> charFunction)

Returns a new primitive char iterable with the results of applying the specified function on each element of the source collection.

public default <R extends MutableCharCollection> R

Returns:

target, which contains appended elements as a result of the collect transformation
collectChar
(CharFunction<? super T>
a CharFunction to use as the collect transformation function
charFunction
,
R
the MutableCharCollection to append to for all elements in this RichIterable
target
)

Same as collectChar(CharFunction), except that the results are gathered into the specified target collection.

public DoubleIterable
collectDouble(DoubleFunction<? super T> doubleFunction)

Returns a new primitive double iterable with the results of applying the specified function on each element of the source collection.

public default <R extends MutableDoubleCollection> R

Returns:

target, which contains appended elements as a result of the collect transformation
collectDouble
(DoubleFunction<? super T>
a DoubleFunction to use as the collect transformation function
doubleFunction
,
R
the MutableDoubleCollection to append to for all elements in this RichIterable
target
)

Same as collectDouble(DoubleFunction), except that the results are gathered into the specified target collection.

public FloatIterable
collectFloat(FloatFunction<? super T> floatFunction)

Returns a new primitive float iterable with the results of applying the specified function on each element of the source collection.

public default <R extends MutableFloatCollection> R

Returns:

target, which contains appended elements as a result of the collect transformation
collectFloat
(FloatFunction<? super T>
a FloatFunction to use as the collect transformation function
floatFunction
,
R
the MutableFloatCollection to append to for all elements in this RichIterable
target
)

Same as collectFloat(FloatFunction), except that the results are gathered into the specified target collection.

public <V> RichIterable<V>
collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)

Returns a new collection with the results of applying the specified function on each element of the source collection, but only for those elements which return true upon evaluation of the predicate.

public <V, R extends Collection<V>> R

Returns:

targetCollection, which contains appended elements as a result of the collect criteria and transformation
collectIf
(Predicate<? super T>
a Predicate to use as the select criteria
predicate
,
Function<? super T, ? extends V>
a Function to use as the collect transformation function
function
,
R
the Collection to append to for all elements in this RichIterable that meet the collect criteria predicate
target
)

Same as the collectIf method with two parameters but uses the specified target collection for the results.

public IntIterable
collectInt(IntFunction<? super T> intFunction)

Returns a new primitive int iterable with the results of applying the specified function on each element of the source collection.

public default <R extends MutableIntCollection> R

Returns:

target, which contains appended elements as a result of the collect transformation
collectInt
(IntFunction<? super T>
a IntFunction to use as the collect transformation function
intFunction
,
R
the MutableIntCollection to append to for all elements in this RichIterable
target
)

Same as collectInt(IntFunction), except that the results are gathered into the specified target collection.

public LongIterable
collectLong(LongFunction<? super T> longFunction)

Returns a new primitive long iterable with the results of applying the specified function on each element of the source collection.

public default <R extends MutableLongCollection> R

Returns:

target, which contains appended elements as a result of the collect transformation
collectLong
(LongFunction<? super T>
a LongFunction to use as the collect transformation function
longFunction
,
R
the MutableLongCollection to append to for all elements in this RichIterable
target
)

Same as collectLong(LongFunction), except that the results are gathered into the specified target collection.

public ShortIterable
collectShort(ShortFunction<? super T> shortFunction)

Returns a new primitive short iterable with the results of applying the specified function on each element of the source collection.

public default <R extends MutableShortCollection> R

Returns:

target, which contains appended elements as a result of the collect transformation
collectShort
(ShortFunction<? super T>
a ShortFunction to use as the collect transformation function
shortFunction
,
R
the MutableShortCollection to append to for all elements in this RichIterable
target
)

Same as collectShort(ShortFunction), except that the results are gathered into the specified target collection.

public <P, V> RichIterable<V>

Returns:

A new RichIterable that contains the transformed elements returned by Function2#value(Object, Object)
collectWith
(Function2<? super T, ? super P, ? extends V>
A Function2 to use as the collect transformation function
function
,
P
A parameter to pass in for evaluation of the second argument P in function
parameter
)

Same as collect(Function) with a Function2 and specified parameter which is passed to the block.

public <P, V, R extends Collection<V>> R

Returns:

targetCollection, which contains appended elements as a result of the collect transformation
collectWith
(Function2<? super T, ? super P, ? extends V>
a Function2 to use as the collect transformation function
function
,
P
a parameter to pass in for evaluation of the second argument P in function
parameter
,
R
the Collection to append to for all elements in this RichIterable that meet select criteria function
targetCollection
)

Same as collectWith but with a targetCollection parameter to gather the results.

public boolean
contains(Object object)

Returns true if the iterable has an element which responds true to element.equals(object).

public boolean
containsAll(Collection<?> source)

Returns true if all elements in source are contained in this collection.

public boolean
containsAllArguments(Object... elements)

Returns true if all elements in the specified var arg array are contained in this collection.

public boolean
containsAllIterable(Iterable<?> source)

Returns true if all elements in source are contained in this collection.

public default boolean
containsAny(Collection<?> source)

Returns true if any of the elements in source is contained in this collection.

public default boolean
containsAnyIterable(Iterable<?> source)

Returns true if any of the elements in source is contained in this collection.

public default <V> boolean
containsBy(Function<? super T, ? extends V> function, V value)

Returns true if the iterable has an element which responds true to element.equals(value) after applying the specified function to the element.

public default boolean
containsNone(Collection<?> source)

Returns true if none of the elements in source are contained in this collection.

public default boolean
containsNoneIterable(Iterable<?> source)

Returns true if none of the elements in source are contained in this collection.

public int
count(Predicate<? super T> predicate)

Return the total number of elements that answer true to the specified predicate.

public default <V> Bag<V>
countBy(Function<? super T, ? extends V> function)

This method will count the number of occurrences of each value calculated by applying the function to each element of the collection.

public default <V, R extends MutableBagIterable<V>> R
countBy(Function<? super T, ? extends V> function, R target)

This method will count the number of occurrences of each value calculated by applying the function to each element of the collection.

public default <V> Bag<V>
countByEach(Function<? super T, ? extends Iterable<V>> function)

This method will count the number of occurrences of each value calculated by applying the function to each element of the collection.

public default <V, R extends MutableBagIterable<V>> R
countByEach(Function<? super T, ? extends Iterable<V>> function, R target)

This method will count the number of occurrences of each value calculated by applying the function to each element of the collection.

public default <V, P> Bag<V>
countByWith(Function2<? super T, ? super P, ? extends V> function, P parameter)

This method will count the number of occurrences of each value calculated by applying the function to each element of the collection with the specified parameter as the second argument.

public default <V, P, R extends MutableBagIterable<V>> R
countByWith(Function2<? super T, ? super P, ? extends V> function, P parameter, R target)

This method will count the number of occurrences of each value calculated by applying the function to each element of the collection with the specified parameter as the second argument.

public <P> int
countWith(Predicate2<? super T, ? super P> predicate, P parameter)

Returns the total number of elements that evaluate to true for the specified predicate.

public T
detect(Predicate<? super T> predicate)

Returns the first element of the iterable for which the predicate evaluates to true or null in the case where no element returns true.

public default T
detectIfNone(Predicate<? super T> predicate, Function0<? extends T> function)

Returns the first element of the iterable for which the predicate evaluates to true.

public Optional<T>
detectOptional(Predicate<? super T> predicate)

Returns the first element of the iterable for which the predicate evaluates to true as an Optional.

public <P> T
detectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Returns the first element that evaluates to true for the specified predicate2 and parameter, or null if none evaluate to true.

public <P> T
detectWithIfNone(Predicate2<? super T, ? super P> predicate, P parameter, Function0<? extends T> function)

Returns the first element of the iterable that evaluates to true for the specified predicate2 and parameter, or returns the value of evaluating the specified function.

public <P> Optional<T>
detectWithOptional(Predicate2<? super T, ? super P> predicate, P parameter)

Returns the first element that evaluates to true for the specified predicate2 and parameter as an Optional.

public void
each(Procedure<? super T> procedure)

The procedure is executed for each element in the iterable.

public <V> RichIterable<V>

Returns:

a new flattened collection produced by applying the given function
flatCollect
(Function<? super T, ? extends Iterable<V>>
The Function to apply
function
)

flatCollect is a special case of collect(Function).

public <V, R extends Collection<V>> R

Returns:

target, which will contain a flattened collection of results produced by applying the given function
flatCollect
(Function<? super T, ? extends Iterable<V>>
The Function to apply
function
,
R
The collection into which results should be added.
target
)

Same as flatCollect, only the results are collected into the target collection.

public default <R extends MutableBooleanCollection> R

Returns:

target, which will contain a flattened collection of results produced by applying the given function
flatCollectBoolean
(Function<? super T, ? extends BooleanIterable>
The Function to apply
function
,
R
The collection into which results should be added.
target
)

Same as flatCollect, only the results are collected into the target collection.

public default <R extends MutableByteCollection> R

Returns:

target, which will contain a flattened collection of results produced by applying the given function
flatCollectByte
(Function<? super T, ? extends ByteIterable>
The Function to apply
function
,
R
The collection into which results should be added.
target
)

Same as flatCollect, only the results are collected into the target collection.

public default <R extends MutableCharCollection> R

Returns:

target, which will contain a flattened collection of results produced by applying the given function
flatCollectChar
(Function<? super T, ? extends CharIterable>
The Function to apply
function
,
R
The collection into which results should be added.
target
)

Same as flatCollect, only the results are collected into the target collection.

public default <R extends MutableDoubleCollection> R

Returns:

target, which will contain a flattened collection of results produced by applying the given function
flatCollectDouble
(Function<? super T, ? extends DoubleIterable>
The Function to apply
function
,
R
The collection into which results should be added.
target
)

Same as flatCollect, only the results are collected into the target collection.

public default <R extends MutableFloatCollection> R

Returns:

target, which will contain a flattened collection of results produced by applying the given function
flatCollectFloat
(Function<? super T, ? extends FloatIterable>
The Function to apply
function
,
R
The collection into which results should be added.
target
)

Same as flatCollect, only the results are collected into the target collection.

public default <R extends MutableIntCollection> R

Returns:

target, which will contain a flattened collection of results produced by applying the given function
flatCollectInt
(Function<? super T, ? extends IntIterable>
The Function to apply
function
,
R
The collection into which results should be added.
target
)

Same as flatCollect, only the results are collected into the target collection.

public default <R extends MutableLongCollection> R

Returns:

target, which will contain a flattened collection of results produced by applying the given function
flatCollectLong
(Function<? super T, ? extends LongIterable>
The Function to apply
function
,
R
The collection into which results should be added.
target
)

Same as flatCollect, only the results are collected into the target collection.

public default <R extends MutableShortCollection> R

Returns:

target, which will contain a flattened collection of results produced by applying the given function
flatCollectShort
(Function<? super T, ? extends ShortIterable>
The Function to apply
function
,
R
The collection into which results should be added.
target
)

Same as flatCollect, only the results are collected into the target collection.

public default <P, V> RichIterable<V>
flatCollectWith(Function2<? super T, ? super P, ? extends Iterable<V>> function, P parameter)

Same as flatCollect, only with a Function2 that is passed an extra parameter.

public default <P, V, R extends Collection<V>> R
flatCollectWith(Function2<? super T, ? super P, ? extends Iterable<V>> function, P parameter, R target)

Same as flatCollectWith, only the results are collected into the target collection.

public default void
forEach(Procedure<? super T> procedure)

Implements org.eclipse.collections.api.InternalIterable.forEach.

The procedure is executed for each element in the iterable.

public default T

Returns:

an element of an iterable.
getAny
()

Returns any element of an iterable.

public T
getFirst()
Deprecated in 6.0. Use OrderedIterable#getFirst() instead.

Returns the first element of an iterable.

public T
getLast()
Deprecated in 6.0. Use OrderedIterable#getLast() instead.

Returns the last element of an iterable.

public default T

Returns:

an element of an iterable.
getOnly
()

Returns the element if the iterable has exactly one element.

public <V> Multimap<V, T>
groupBy(Function<? super T, ? extends V> function)

For each element of the iterable, the function is evaluated and the results of these evaluations are collected into a new multimap, where the transformed value is the key and the original values are added to the same (or similar) species of collection as the source iterable.

public <V, R extends MutableMultimap<V, T>> R
groupBy(Function<? super T, ? extends V> function, R target)

Same as groupBy(Function), except that the results are gathered into the specified target multimap.

public default <K, V, R extends MutableMultimap<K, V>> R

Returns:

The target collection where the key is the transformed result from applying the groupBy function and the value is the transformed result from applying the collect function.
groupByAndCollect
(Function<? super T, ? extends K>
a Function to use as the groupBy transformation function
groupByFunction
,
Function<? super T, ? extends V>
a Function to use as the collect transformation function
collectFunction
,
R target)

Applies a groupBy function over the iterable, followed by a collect function.

public <V> Multimap<V, T>
groupByEach(Function<? super T, ? extends Iterable<V>> function)

Similar to groupBy(Function), except the result of evaluating function will return a collection of keys for each value.

public <V, R extends MutableMultimap<V, T>> R
groupByEach(Function<? super T, ? extends Iterable<V>> function, R target)

Same as groupByEach(Function), except that the results are gathered into the specified target multimap.

public <V> MapIterable<V, T>
groupByUniqueKey(Function<? super T, ? extends V> function)

For each element of the iterable, the function is evaluated, and the results of these evaluations are collected into a new map, where the transformed value is the key.

public <V, R extends MutableMapIterable<V, T>> R
groupByUniqueKey(Function<? super T, ? extends V> function, R target)

Same as groupByUniqueKey(Function), except that the results are gathered into the specified target map.

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

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

public int
injectInto(int injectedValue, IntObjectToIntFunction<? super T> function)
Deprecated since 11.1 - use injectIntoInt instead

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

public long
injectInto(long injectedValue, LongObjectToLongFunction<? super T> function)
Deprecated since 11.1 - use injectIntoLong instead

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

public float
injectInto(float injectedValue, FloatObjectToFloatFunction<? super T> function)
Deprecated since 11.1 - use injectIntoFloat instead

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

public double
injectInto(double injectedValue, DoubleObjectToDoubleFunction<? super T> function)
Deprecated since 11.1 - use injectIntoDouble instead

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

public default double
injectIntoDouble(double injectedValue, DoubleObjectToDoubleFunction<? super T> 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, FloatObjectToFloatFunction<? super T> 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, IntObjectToIntFunction<? super T> 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, LongObjectToLongFunction<? super T> function)

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

public <R extends Collection<T>> R
into(R target)

Adds all the elements in this iterable to the specific target Collection.

public boolean
isEmpty()

Returns true if this iterable has zero items.

public default String

Returns:

a string representation of this collection.
makeString
()

Returns a string representation of this collection by delegating to makeString(String) and defaulting the separator parameter to the characters ", " (comma and space).

public default String

Returns:

a string representation of this collection.
makeString
(String separator)

Returns a string representation of this collection by delegating to makeString(String, String, String) and defaulting the start and end parameters to "" (the empty String).

public default String

Returns:

a string representation of this collection.
makeString
(String start, String separator, String end)

Returns a string representation of this collection with the elements separated by the specified separator and enclosed between the start and end strings.

public default String

Returns:

a string representation of the mapped collection
makeString
(Function<? super T, Object> function, String start, String separator, String end)

Returns a string representation of the collection, created by applying the function supplied to each element, with the elements separated by the specified separator and enclosed between the start and end strings.

public T
max(Comparator<? super T> comparator)

Returns the maximum element out of this container based on the comparator.

public T
max()

Returns the maximum element out of this container based on the natural order.

public <V extends Comparable<? super V>> T
maxBy(Function<? super T, ? extends V> function)

Returns the maximum elements out of this container based on the natural order of the attribute returned by Function.

public default <V extends Comparable<? super V>> Optional<T>
maxByOptional(Function<? super T, ? extends V> function)

Returns the maximum elements out of this container based on the natural order of the attribute returned by Function as an Optional.

public default Optional<T>
maxOptional(Comparator<? super T> comparator)

Returns the maximum element out of this container based on the comparator as an Optional.

public default Optional<T>
maxOptional()

Returns the maximum element out of this container based on the natural order as an Optional.

public T
min(Comparator<? super T> comparator)

Returns the minimum element out of this container based on the comparator.

public T
min()

Returns the minimum element out of this container based on the natural order.

public <V extends Comparable<? super V>> T
minBy(Function<? super T, ? extends V> function)

Returns the minimum elements out of this container based on the natural order of the attribute returned by Function.

public default <V extends Comparable<? super V>> Optional<T>
minByOptional(Function<? super T, ? extends V> function)

Returns the minimum elements out of this container based on the natural order of the attribute returned by Function as an Optional.

public default Optional<T>
minOptional(Comparator<? super T> comparator)

Returns the minimum element out of this container based on the comparator as an Optional.

public default Optional<T>
minOptional()

Returns the minimum element out of this container based on the natural order as an Optional.

public boolean
noneSatisfy(Predicate<? super T> predicate)

Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty.

public <P> boolean
noneSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Returns true if the predicate evaluates to false for every element of the collection, or return false.

public default boolean
notEmpty()

The English equivalent of !this.isEmpty()

public PartitionIterable<T>
partition(Predicate<? super T> predicate)

Filters a collection into a PartitionedIterable based on the evaluation of the predicate.

public <P> PartitionIterable<T>
partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)

Filters a collection into a PartitionIterable based on the evaluation of the predicate.

public default Optional<T>
reduce(BinaryOperator<T> accumulator)

This method produces the equivalent result as Stream#reduce(BinaryOperator).

public default <K> MapIterable<K, T>
reduceBy(Function<? super T, ? extends K> groupBy, Function2<? super T, ? super T, ? extends T> reduceFunction)

Applies an aggregate function over the iterable grouping results into a map based on the specific groupBy function.

public default <K, R extends MutableMapIterable<K, T>> R
reduceBy(Function<? super T, ? extends K> groupBy, Function2<? super T, ? super T, ? extends T> reduceFunction, R target)

Applies an aggregate function over the iterable grouping results into a map based on the specific groupBy function.

public default <R, A> R
reduceInPlace(Collector<? super T, A, R> collector)

This method produces the equivalent result as Stream#collect(Collector).

public default <R> R
reduceInPlace(Supplier<R> supplier, BiConsumer<R, ? super T> accumulator)

This method produces the equivalent result as Stream#collect(Supplier, BiConsumer, BiConsumer).

public RichIterable<T>

Returns:

a RichIterable that contains elements that cause Predicate#accept(Object) method to evaluate to false
reject
(Predicate<? super T>
a Predicate to use as the reject criteria
predicate
)

Returns all elements of the source collection that return false when evaluating of the predicate.

public <R extends Collection<T>> R

Returns:

target, which contains appended elements as a result of the reject criteria
reject
(Predicate<? super T>
a Predicate to use as the reject criteria
predicate
,
R
the Collection to append to for all elements in this RichIterable that cause Predicate#accept(Object) method to evaluate to false
target
)

Same as the reject method with one parameter but uses the specified target collection for the results.

public <P> RichIterable<T>
rejectWith(Predicate2<? super T, ? super P>
a Predicate2 to use as the select criteria
predicate
,
P
a parameter to pass in for evaluation of the second argument P in predicate
parameter
)

Similar to reject(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

public <P, R extends Collection<T>> R

Returns:

targetCollection, which contains appended elements as a result of the reject criteria
rejectWith
(Predicate2<? super T, ? super P>
a Predicate2 to use as the reject criteria
predicate
,
P
a parameter to pass in for evaluation of the second argument P in predicate
parameter
,
R
the Collection to append to for all elements in this RichIterable that cause Predicate#accept(Object) method to evaluate to false
targetCollection
)

Similar to reject(Predicate, Collection), except with an evaluation parameter for the second generic argument in Predicate2.

public RichIterable<T>
select(Predicate<? super T> predicate)

Returns all elements of the source collection that return true when evaluating the predicate.

public <R extends Collection<T>> R

Returns:

target, which contains appended elements as a result of the select criteria
select
(Predicate<? super T>
a Predicate to use as the select criteria
predicate
,
R
the Collection to append to for all elements in this RichIterable that meet select criteria predicate
target
)

Same as the select method with one parameter but uses the specified target collection for the results.

public <S> RichIterable<S>
selectInstancesOf(Class<S> clazz)

Returns all elements of the source collection that are instances of the Class clazz.

public <P> RichIterable<T>
selectWith(Predicate2<? super T, ? super P>
a Predicate2 to use as the select criteria
predicate
,
P
a parameter to pass in for evaluation of the second argument P in predicate
parameter
)

Similar to select(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

public <P, R extends Collection<T>> R

Returns:

targetCollection, which contains appended elements as a result of the select criteria
selectWith
(Predicate2<? super T, ? super P>
a Predicate2 to use as the select criteria
predicate
,
P
a parameter to pass in for evaluation of the second argument P in predicate
parameter
,
R
the Collection to append to for all elements in this RichIterable that meet select criteria predicate
targetCollection
)

Similar to select(Predicate, Collection), except with an evaluation parameter for the second generic argument in Predicate2.

public int
size()

Returns the number of items in this iterable.

public <V> ObjectDoubleMap<V>
sumByDouble(Function<? super T, ? extends V> groupBy, DoubleFunction<? super T> function)

Groups and sums the values using the two specified functions.

public <V> ObjectDoubleMap<V>
sumByFloat(Function<? super T, ? extends V> groupBy, FloatFunction<? super T> function)

Groups and sums the values using the two specified functions.

public <V> ObjectLongMap<V>
sumByInt(Function<? super T, ? extends V> groupBy, IntFunction<? super T> function)

Groups and sums the values using the two specified functions.

public <V> ObjectLongMap<V>
sumByLong(Function<? super T, ? extends V> groupBy, LongFunction<? super T> function)

Groups and sums the values using the two specified functions.

public default DoubleSummaryStatistics
summarizeDouble(DoubleFunction<? super T> function)

Returns the result of summarizing the value returned from applying the DoubleFunction to each element of the iterable.

public default DoubleSummaryStatistics
summarizeFloat(FloatFunction<? super T> function)

Returns the result of summarizing the value returned from applying the FloatFunction to each element of the iterable.

public default IntSummaryStatistics
summarizeInt(IntFunction<? super T> function)

Returns the result of summarizing the value returned from applying the IntFunction to each element of the iterable.

public default LongSummaryStatistics
summarizeLong(LongFunction<? super T> function)

Returns the result of summarizing the value returned from applying the LongFunction to each element of the iterable.

public double
sumOfDouble(DoubleFunction<? super T> function)

Returns the final double result of evaluating function for each element of the iterable and adding the results together.

public double
sumOfFloat(FloatFunction<? super T> function)

Returns the final double result of evaluating function for each element of the iterable and adding the results together.

public long
sumOfInt(IntFunction<? super T> function)

Returns the final long result of evaluating function for each element of the iterable and adding the results together.

public long
sumOfLong(LongFunction<? super T> function)

Returns the final long result of evaluating function for each element of the iterable and adding the results together.

public RichIterable<T>
tap(Procedure<? super T> procedure)

Executes the Procedure for each element in the iterable and returns this.

public default Object[]
toArray()

Converts this iterable to an array.

public default <E> E[]
toArray(E[] array)

Converts this iterable to an array using the specified target array, assuming the target array is as long or longer than the iterable.

public MutableBag<T>
toBag()

Converts the collection to the default MutableBag implementation.

public <NK, NV> MutableBiMap<NK, NV>
toBiMap(Function<? super T, ? extends NK> keyFunction, Function<? super T, ? extends NV> valueFunction)

Converts the collection to a BiMap implementation using the specified key and value functions.

public default ImmutableBag<T>
toImmutableBag()

Converts the RichIterable to the default ImmutableBag implementation.

public default <NK, NV> ImmutableBiMap<NK, NV>
toImmutableBiMap(Function<? super T, ? extends NK> keyFunction, Function<? super T, ? extends NV> valueFunction)

Converts the collection to an immutable BiMap implementation using the specified key and value functions.

public default ImmutableList<T>
toImmutableList()

Converts the RichIterable to the default ImmutableList implementation.

public default <NK, NV> ImmutableMap<NK, NV>
toImmutableMap(Function<? super T, ? extends NK> keyFunction, Function<? super T, ? extends NV> valueFunction)

Converts the collection to an ImmutableMap implementation using the specified key and value functions.

public default ImmutableSet<T>
toImmutableSet()

Converts the RichIterable to the default ImmutableSet implementation.

public default ImmutableSortedBag<T>
toImmutableSortedBag()

Converts the RichIterable to the default ImmutableSortedBag implementation.

public default ImmutableSortedBag<T>
toImmutableSortedBag(Comparator<? super T> comparator)

Converts the collection to an ImmutableSortedBag implementation and sorts it using the specified comparator.

public default <V extends Comparable<? super V>> ImmutableSortedBag<T>
toImmutableSortedBagBy(Function<? super T, ? extends V> function)

Converts the collection to an ImmutableSortedBag implementation and sorts it based on the natural order of the attribute returned by function.

public default ImmutableList<T>
toImmutableSortedList()

Converts the RichIterable to the default sorted ImmutableList implementation.

public default ImmutableList<T>
toImmutableSortedList(Comparator<? super T> comparator)

Converts the collection to an ImmutableList implementation and sorts it using the specified comparator.

public default <V extends Comparable<? super V>> ImmutableList<T>
toImmutableSortedListBy(Function<? super T, ? extends V> function)

Converts the collection to an ImmutableList implementation and sorts it based on the natural order of the attribute returned by function.

public default ImmutableSortedSet<T>
toImmutableSortedSet()

Converts the RichIterable to the default ImmutableSortedSet implementation.

public default ImmutableSortedSet<T>
toImmutableSortedSet(Comparator<? super T> comparator)

Converts the collection to an ImmutableSortedSet implementation and sorts it using the specified comparator.

public default <V extends Comparable<? super V>> ImmutableSortedSet<T>
toImmutableSortedSetBy(Function<? super T, ? extends V> function)

Converts the collection to an ImmutableSortedSet implementation and sorts it based on the natural order of the attribute returned by function.

public MutableList<T>
toList()

Converts the collection to a MutableList implementation.

public <NK, NV> MutableMap<NK, NV>
toMap(Function<? super T, ? extends NK> keyFunction, Function<? super T, ? extends NV> valueFunction)

Converts the collection to a MutableMap implementation using the specified key and value functions.

public default <NK, NV, R extends Map<NK, NV>> R
toMap(Function<? super T, ? extends NK> keyFunction, Function<? super T, ? extends NV> valueFunction, R target)

Same as toMap(Function, Function), except that the results are gathered into the specified target map.

public MutableSet<T>
toSet()

Converts the collection to a MutableSet implementation.

public MutableSortedBag<T>
toSortedBag()

Converts the collection to a MutableSortedBag implementation and sorts it using the natural order of the elements.

public MutableSortedBag<T>
toSortedBag(Comparator<? super T> comparator)

Converts the collection to the MutableSortedBag implementation and sorts it using the specified comparator.

public default <V extends Comparable<? super V>> MutableSortedBag<T>
toSortedBagBy(Function<? super T, ? extends V> function)

Converts the collection to a MutableSortedBag implementation and sorts it based on the natural order of the attribute returned by function.

public default MutableList<T>
toSortedList()

Converts the collection to a MutableList implementation and sorts it using the natural order of the elements.

public default MutableList<T>
toSortedList(Comparator<? super T> comparator)

Converts the collection to a MutableList implementation and sorts it using the specified comparator.

public default <V extends Comparable<? super V>> MutableList<T>
toSortedListBy(Function<? super T, ? extends V> function)

Converts the collection to a MutableList implementation and sorts it based on the natural order of the attribute returned by function.

public <NK, NV> MutableSortedMap<NK, NV>
toSortedMap(Function<? super T, ? extends NK> keyFunction, Function<? super T, ? extends NV> valueFunction)

Converts the collection to a MutableSortedMap implementation using the specified key and value functions sorted by the key elements' natural ordering.

public <NK, NV> MutableSortedMap<NK, NV>
toSortedMap(Comparator<? super NK> comparator, Function<? super T, ? extends NK> keyFunction, Function<? super T, ? extends NV> valueFunction)

Converts the collection to a MutableSortedMap implementation using the specified key and value functions sorted by the given comparator.

public default <KK extends Comparable<? super KK>, NK, NV> MutableSortedMap<NK, NV>
toSortedMapBy(Function<? super NK, KK> sortBy, Function<? super T, ? extends NK> keyFunction, Function<? super T, ? extends NV> valueFunction)

Converts the collection to a MutableSortedMap implementation using the specified key and value functions and sorts it based on the natural order of the attribute returned by sortBy function.

public MutableSortedSet<T>
toSortedSet()

Converts the collection to a MutableSortedSet implementation and sorts it using the natural order of the elements.

public MutableSortedSet<T>
toSortedSet(Comparator<? super T> comparator)

Converts the collection to a MutableSortedSet implementation and sorts it using the specified comparator.

public default <V extends Comparable<? super V>> MutableSortedSet<T>
toSortedSetBy(Function<? super T, ? extends V> function)

Converts the collection to a MutableSortedSet implementation and sorts it based on the natural order of the attribute returned by function.

public String

Returns:

a string representation of this RichIterable
toString
()

Returns a string with the elements of this iterable separated by commas with spaces and enclosed in square brackets.

public <
the type of the second half of the returned pairs
S
>
RichIterable<Pair<T, S>>

Returns:

A new RichIterable containing pairs consisting of corresponding elements of this RichIterable and that. The length of the returned RichIterable is the minimum of the lengths of this RichIterable and that.
zip
(Iterable<S>
The RichIterable providing the second half of each result pair
that
)
Deprecated in 6.0. Use OrderedIterable#zip(Iterable) instead.

Returns a RichIterable formed from this RichIterable and another RichIterable by combining corresponding elements in pairs.

public <S, R extends Collection<Pair<T, S>>> R
zip(Iterable<S> that, R target)
Deprecated in 6.0. Use OrderedIterable#zip(Iterable, Collection) instead;

Same as zip(Iterable) but uses target for output.

public RichIterable<Pair<T, Integer>>

Returns:

A new RichIterable containing pairs consisting of all elements of this RichIterable paired with their index. Indices start at 0.
zipWithIndex
()
Deprecated in 6.0. Use OrderedIterable#zipWithIndex() instead.

Zips this RichIterable with its indices.

public <R extends Collection<Pair<T, Integer>>> R
zipWithIndex(R target)
Deprecated in 6.0. Use OrderedIterable#zipWithIndex(Collection) instead.

Same as zipWithIndex() but uses target for output.

Inherited from org.eclipse.collections.api.InternalIterable:
forEachforEachWithforEachWithIndex