Top Description Methods
org.eclipse.collections.api.ordered

public Interface ReversibleIterable<T>

extends OrderedIterable<T>
Known Direct Subinterfaces
org.eclipse.collections.api.set.sorted.SortedSetIterable, org.eclipse.collections.api.bag.sorted.SortedBag, org.eclipse.collections.api.list.ListIterable, org.eclipse.collections.api.map.OrderedMap, org.eclipse.collections.api.map.sorted.SortedMapIterable
Imports
org.eclipse.collections.api.LazyIterable, org.eclipse.collections.api.block.function.Function, .Function2, org.eclipse.collections.api.block.function.primitive.BooleanFunction, .ByteFunction, .CharFunction, .DoubleFunction, .FloatFunction, .IntFunction, .LongFunction, .ObjectIntToObjectFunction, .ShortFunction, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.block.procedure.Procedure, org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure, org.eclipse.collections.api.multimap.ordered.ReversibleIterableMultimap, org.eclipse.collections.api.ordered.primitive.ReversibleBooleanIterable, .ReversibleByteIterable, .ReversibleCharIterable, .ReversibleDoubleIterable, .ReversibleFloatIterable, .ReversibleIntIterable, .ReversibleLongIterable, .ReversibleShortIterable, org.eclipse.collections.api.partition.ordered.PartitionReversibleIterable, org.eclipse.collections.api.tuple.Pair

A ReversibleIterable is an ordered iterable that you can iterate over forwards or backwards. It has methods that support efficient iteration from the end, including asReversed() and reverseForEach(Procedure).
Since
5.0

Method Summary

Modifier and TypeMethod and Description
public default LazyIterable<T>
asReversed()

Returns a reversed view of this ReversibleIterable.

public <V> ReversibleIterable<V>
collect(Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collect.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectBoolean.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectByte.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectChar.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectDouble.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectFloat.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectIf.

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 ReversibleIntIterable
collectInt(IntFunction<? super T> intFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectInt.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectLong.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectShort.

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

public <P, V> ReversibleIterable<V>
collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectWith.

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

public default <V> ReversibleIterable<V>
collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function)

Overrides default org.eclipse.collections.api.ordered.OrderedIterable.collectWithIndex.

Returns a new OrderedIterable using results obtained by applying the specified function to each element and its corresponding index.

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

Returns the index of the last element of the ReversibleIterable for which the predicate evaluates to true.

public ReversibleIterable<T>
distinct()

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.distinct.

Returns a new OrderedIterable containing the distinct elements in this iterable.

public ReversibleIterable<T>
drop(int
the number of items to drop.
count
)

Returns an iterable after skipping the first count elements or an empty iterable if the count is greater than the length of the iterable.

public ReversibleIterable<T>
dropWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.dropWhile.

Returns the final elements that do not satisfy the Predicate.

public <V> ReversibleIterable<V>
flatCollect(Function<? super T, ? extends Iterable<V>> function)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.flatCollect.

flatCollect is a special case of collect(Function).

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

Overrides default org.eclipse.collections.api.ordered.OrderedIterable.flatCollectWith.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.groupBy.

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> ReversibleIterableMultimap<V, T>
groupByEach(Function<? super T, ? extends Iterable<V>> function)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.groupByEach.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.partition.

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

public PartitionReversibleIterable<T>
partitionWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.partitionWhile.

Returns a Partition of the initial elements that satisfy the Predicate and the remaining elements.

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.partitionWith.

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

public ReversibleIterable<T>
reject(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.reject.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.rejectWith.

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

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

Evaluates the procedure for each element of the list iterating in reverse order.

public default void
reverseForEachWithIndex(ObjectIntProcedure<? super T> procedure)

Evaluates the procedure for each element and it's index in reverse order.

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.select.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.selectInstancesOf.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.selectWith.

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

public ReversibleIterable<T>
take(int
the number of items to take.
count
)

Returns the first count elements of the iterable or all the elements in the iterable if count is greater than the length of the iterable.

public ReversibleIterable<T>
takeWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.takeWhile.

Returns the initial elements that satisfy the Predicate.

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.tap.

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

public ReversibleIterable<T>
toReversed()

Returns a new ReversibleIterable in reverse order.

public <S> ReversibleIterable<Pair<T, S>>
zip(Iterable<S> that)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.zip.

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

public ReversibleIterable<Pair<T, Integer>>
zipWithIndex()

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.zipWithIndex.

Zips this RichIterable with its indices.

Inherited from org.eclipse.collections.api.ordered.OrderedIterable:
collectWithIndexcorrespondsdetectIndexforEachforEachWithIndexforEachWithIndexgetFirstgetFirstOptionalgetLastgetLastOptionalindexOfmaxminrejectWithIndexselectWithIndextoStackzipzipWithIndex

Method Detail

asReversedback to summary
public default LazyIterable<T> asReversed()

Returns a reversed view of this ReversibleIterable.

collectback to summary
public <V> ReversibleIterable<V> collect(Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collect.

Doc from org.eclipse.collections.api.RichIterable.collect.

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.

Example using a Java 8 lambda expression:

RichIterable<String> names =
    people.collect(person -> person.getFirstName() + " " + person.getLastName());
Annotations
@Override
collectBooleanback to summary
public ReversibleBooleanIterable collectBoolean(BooleanFunction<? super T> booleanFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectBoolean.

Doc from org.eclipse.collections.api.RichIterable.collectBoolean.

Returns a new primitive boolean iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

Example using a Java 8 lambda expression:

BooleanIterable licenses =
    people.collectBoolean(person -> person.hasDrivingLicense());
Annotations
@Override
collectByteback to summary
public ReversibleByteIterable collectByte(ByteFunction<? super T> byteFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectByte.

Doc from org.eclipse.collections.api.RichIterable.collectByte.

Returns a new primitive byte iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

Example using a Java 8 lambda expression:

ByteIterable bytes =
    people.collectByte(person -> person.getCode());
Annotations
@Override
collectCharback to summary
public ReversibleCharIterable collectChar(CharFunction<? super T> charFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectChar.

Doc from org.eclipse.collections.api.RichIterable.collectChar.

Returns a new primitive char iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

Example using a Java 8 lambda expression:

CharIterable chars =
    people.collectChar(person -> person.getMiddleInitial());
Annotations
@Override
collectDoubleback to summary
public ReversibleDoubleIterable collectDouble(DoubleFunction<? super T> doubleFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectDouble.

Doc from org.eclipse.collections.api.RichIterable.collectDouble.

Returns a new primitive double iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

Example using a Java 8 lambda expression:

DoubleIterable doubles =
    people.collectDouble(person -> person.getMilesFromNorthPole());
Annotations
@Override
collectFloatback to summary
public ReversibleFloatIterable collectFloat(FloatFunction<? super T> floatFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectFloat.

Doc from org.eclipse.collections.api.RichIterable.collectFloat.

Returns a new primitive float iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

Example using a Java 8 lambda expression:

FloatIterable floats =
    people.collectFloat(person -> person.getHeightInInches());
Annotations
@Override
collectIfback to summary
public <V> ReversibleIterable<V> collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectIf.

Doc from org.eclipse.collections.api.RichIterable.collectIf.

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. This is the optimized equivalent of calling iterable.select(predicate).collect(function).

Example using a Java 8 lambda and method reference:

RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(e -> e != null, Object::toString);

Example using Predicates factory:

RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(Predicates.notNull(), Functions.getToString());
Annotations
@Override
collectIntback to summary
public ReversibleIntIterable collectInt(IntFunction<? super T> intFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectInt.

Doc from org.eclipse.collections.api.RichIterable.collectInt.

Returns a new primitive int iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

Example using a Java 8 lambda expression:

IntIterable ints =
    people.collectInt(person -> person.getAge());
Annotations
@Override
collectLongback to summary
public ReversibleLongIterable collectLong(LongFunction<? super T> longFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectLong.

Doc from org.eclipse.collections.api.RichIterable.collectLong.

Returns a new primitive long iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

Example using a Java 8 lambda expression:

LongIterable longs =
    people.collectLong(person -> person.getGuid());
Annotations
@Override
collectShortback to summary
public ReversibleShortIterable collectShort(ShortFunction<? super T> shortFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectShort.

Doc from org.eclipse.collections.api.RichIterable.collectShort.

Returns a new primitive short iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

Example using a Java 8 lambda expression:

ShortIterable shorts =
    people.collectShort(person -> person.getNumberOfJunkMailItemsReceivedPerMonth());
Annotations
@Override
collectWithback to summary
public <P, V> ReversibleIterable<V> collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectWith.

Doc from org.eclipse.collections.api.RichIterable.collectWith.

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

Example using a Java 8 lambda expression:

RichIterable<Integer> integers =
    Lists.mutable.with(1, 2, 3).collectWith((each, parameter) -> each + parameter, Integer.valueOf(1));
Annotations
@Override
collectWithIndexback to summary
public default <V> ReversibleIterable<V> collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function)

Overrides default org.eclipse.collections.api.ordered.OrderedIterable.collectWithIndex.

Doc from org.eclipse.collections.api.ordered.OrderedIterable.collectWithIndex.

Returns a new OrderedIterable using results obtained by applying the specified function to each element and its corresponding index.

Annotations
@Override
Since
9.1.
detectLastIndexback to summary
public int detectLastIndex(Predicate<? super T> predicate)

Returns the index of the last element of the ReversibleIterable for which the predicate evaluates to true. Returns -1 if no element evaluates true for the predicate.

Since
6.0
distinctback to summary
public ReversibleIterable<T> distinct()

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.distinct.

Doc from org.eclipse.collections.api.ordered.OrderedIterable.distinct.

Returns a new OrderedIterable containing the distinct elements in this iterable.

Conceptually similar to toSet().toList() but retains the original order. If an element appears multiple times in this iterable, the first one will be copied into the result.

Annotations
@Override
dropback to summary
public ReversibleIterable<T> drop(int count)

Returns an iterable after skipping the first count elements or an empty iterable if the count is greater than the length of the iterable.

Parameters
count:int

the number of items to drop.

Exceptions
IllegalArgumentException:
if count is less than zero
Since
6.0
dropWhileback to summary
public ReversibleIterable<T> dropWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.dropWhile.

Returns the final elements that do not satisfy the Predicate. Short circuits at the first element which does satisfy the Predicate.

Annotations
@Override
flatCollectback to summary
public <V> ReversibleIterable<V> flatCollect(Function<? super T, ? extends Iterable<V>> function)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.flatCollect.

Doc from org.eclipse.collections.api.RichIterable.flatCollect.

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

Consider the following example where we have a Person class, and each Person has a list of Address objects. Take the following Function:

Function<Person, List<Address>> addressFunction = Person::getAddresses;
RichIterable<Person> people = ...;
Using collect returns a collection of collections of addresses.
RichIterable<List<Address>> addresses = people.collect(addressFunction);
Using flatCollect returns a single flattened list of addresses.
RichIterable<Address> addresses = people.flatCollect(addressFunction);
Annotations
@Override
flatCollectWithback to summary
public default <P, V> ReversibleIterable<V> flatCollectWith(Function2<? super T, ? super P, ? extends Iterable<V>> function, P parameter)

Overrides default org.eclipse.collections.api.ordered.OrderedIterable.flatCollectWith.

Doc from org.eclipse.collections.api.RichIterable.flatCollectWith.

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

Annotations
@Override
Since
9.2
groupByback to summary
public <V> ReversibleIterableMultimap<V, T> groupBy(Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.groupBy.

Doc from org.eclipse.collections.api.RichIterable.groupBy.

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.

Example using a Java 8 method reference:

Multimap<String, Person> peopleByLastName =
    people.groupBy(Person::getLastName);
Annotations
@Override
groupByEachback to summary
public <V> ReversibleIterableMultimap<V, T> groupByEach(Function<? super T, ? extends Iterable<V>> function)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.groupByEach.

Doc from org.eclipse.collections.api.RichIterable.groupByEach.

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

Annotations
@Override
partitionback to summary
public PartitionReversibleIterable<T> partition(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.partition.

Doc from org.eclipse.collections.api.RichIterable.partition.

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

Example using a Java 8 lambda expression:

PartitionIterable<Person> newYorkersAndNonNewYorkers =
    people.partition(person -> person.getAddress().getState().getName().equals("New York"));
Annotations
@Override
partitionWhileback to summary
public PartitionReversibleIterable<T> partitionWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.partitionWhile.

Doc from org.eclipse.collections.api.ordered.OrderedIterable.partitionWhile.

Returns a Partition of the initial elements that satisfy the Predicate and the remaining elements. Short circuits at the first element which does satisfy the Predicate.

Annotations
@Override
partitionWithback to summary
public <P> PartitionReversibleIterable<T> partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.partitionWith.

Doc from org.eclipse.collections.api.RichIterable.partitionWith.

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

Example using a Java 8 lambda expression:

PartitionIterable<Person> newYorkersAndNonNewYorkers =
    people.partitionWith((Person person, String state) -> person.getAddress().getState().getName().equals(state), "New York");
Annotations
@Override
rejectback to summary
public ReversibleIterable<T> reject(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.reject.

Doc from org.eclipse.collections.api.RichIterable.reject.

Returns all elements of the source collection that return false when evaluating of the predicate. This method is also sometimes called filterNot and is the equivalent of calling iterable.select(Predicates.not(predicate)).

Example using a Java 8 lambda expression:

RichIterable<Person> rejected =
    people.reject(person -> person.person.getLastName().equals("Smith"));
Annotations
@Override
rejectWithback to summary
public <P> ReversibleIterable<T> rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.rejectWith.

Doc from org.eclipse.collections.api.RichIterable.rejectWith.

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

E.g. return a Collection of Person elements where the person has an age greater than or equal to 18 years

Example using a Java 8 lambda expression:

RichIterable<Person> rejected =
    people.rejectWith((Person person, Integer age) -> person.getAge() < age, Integer.valueOf(18));
Annotations
@Override
reverseForEachback to summary
public default void reverseForEach(Procedure<? super T> procedure)

Evaluates the procedure for each element of the list iterating in reverse order.

e.g.
people.reverseForEach(person -> LOGGER.info(person.getName()));
reverseForEachWithIndexback to summary
public default void reverseForEachWithIndex(ObjectIntProcedure<? super T> procedure)

Evaluates the procedure for each element and it's index in reverse order.

e.g.
people.reverseForEachWithIndex((person, index) ->
        LOGGER.info("Index: " + index + " person: " + person.getName()));
Since
9.0.0
selectback to summary
public ReversibleIterable<T> select(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.select.

Doc from org.eclipse.collections.api.RichIterable.select.

Returns all elements of the source collection that return true when evaluating the predicate. This method is also commonly called filter.

Example using a Java 8 lambda expression:

RichIterable<Person> selected =
    people.select(person -> person.getAddress().getCity().equals("London"));
Annotations
@Override
selectInstancesOfback to summary
public <S> ReversibleIterable<S> selectInstancesOf(Class<S> clazz)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.selectInstancesOf.

Doc from org.eclipse.collections.api.RichIterable.selectInstancesOf.

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

RichIterable<Integer> integers =
    List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);
Annotations
@Override
selectWithback to summary
public <P> ReversibleIterable<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.selectWith.

Doc from org.eclipse.collections.api.RichIterable.selectWith.

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

E.g. return a Collection of Person elements where the person has an age greater than or equal to 18 years

Example using a Java 8 lambda expression:

RichIterable<Person> selected =
    people.selectWith((Person person, Integer age) -> person.getAge()>= age, Integer.valueOf(18));
Annotations
@Override
takeback to summary
public ReversibleIterable<T> take(int count)

Returns the first count elements of the iterable or all the elements in the iterable if count is greater than the length of the iterable.

Parameters
count:int

the number of items to take.

Exceptions
IllegalArgumentException:
if count is less than zero
Since
6.0
takeWhileback to summary
public ReversibleIterable<T> takeWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.takeWhile.

Returns the initial elements that satisfy the Predicate. Short circuits at the first element which does not satisfy the Predicate.

Annotations
@Override
tapback to summary
public ReversibleIterable<T> tap(Procedure<? super T> procedure)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.tap.

Doc from org.eclipse.collections.api.RichIterable.tap.

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

Example using a Java 8 lambda expression:

RichIterable<Person> tapped =
    people.tap(person -> LOGGER.info(person.getName()));
Annotations
@Override
toReversedback to summary
public ReversibleIterable<T> toReversed()

Returns a new ReversibleIterable in reverse order.

Since
6.0.0
zipback to summary
public <S> ReversibleIterable<Pair<T, S>> zip(Iterable<S> that)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.zip.

Doc from org.eclipse.collections.api.ordered.OrderedIterable.zip.

Returns a OrderedIterable formed from this OrderedIterable and another Iterable by combining corresponding elements in pairs. The second Iterable should also be ordered. If one of the two Iterables is longer than the other, its remaining elements are ignored.

Annotations
@Override
zipWithIndexback to summary
public ReversibleIterable<Pair<T, Integer>> zipWithIndex()

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.zipWithIndex.

Doc from org.eclipse.collections.api.RichIterable.zipWithIndex.

Zips this RichIterable with its indices.

Annotations
@Override