Top Description Methods
org.eclipse.collections.api

public Interface InternalIterable<T>

extends Iterable<T>
Known Direct Subinterfaces
org.eclipse.collections.api.RichIterable
Imports
java.util.function.Consumer, org.eclipse.collections.api.block.procedure.Procedure, .Procedure2, org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure, org.eclipse.collections.api.ordered.OrderedIterable

The base interface for all Eclipse Collections. All Eclipse Collections are internally iterable, and this interface provides the base set of internal iterators that every Eclipse collection should implement.

Method Summary

Modifier and TypeMethod and Description
public void
forEach(Procedure<? super T> procedure)

The procedure is executed for each element in the iterable.

public default void
forEach(Consumer<? super T> consumer)

Overrides default java.lang.Iterable.forEach.

Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception.

public <P> void
forEachWith(Procedure2<? super T, ? super P> procedure, P parameter)

The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.

public void
forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)
Deprecated in 6.0.

Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.

Inherited from java.lang.Iterable:
iteratorspliterator

Method Detail

forEachback to summary
public void forEach(Procedure<? super T> procedure)

The procedure is executed for each element in the iterable.

Example using a Java 8 lambda:

people.forEach(Procedures.cast(person -> LOGGER.info(person.getName())));

Example using an anonymous inner class:

people.forEach(new Procedure<Person>()
{
    public void value(Person person)
    {
        LOGGER.info(person.getName());
    }
});
NOTE: This method started to conflict with Iterable#forEach(java.util.function.Consumer) since Java 1.8. It is recommended to use RichIterable#each(Procedure) instead to avoid casting to Procedure.
Annotations
@SuppressWarnings:UnnecessaryFullyQualifiedName
See Also
RichIterable#each(Procedure), Iterable#forEach(java.util.function.Consumer)
forEachback to summary
public default void forEach(Consumer<? super T> consumer)

Overrides default java.lang.Iterable.forEach.

Doc from java.lang.Iterable.forEach.

Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.

The behavior of this method is unspecified if the action performs side-effects that modify the underlying source of elements, unless an overriding class has specified a concurrent modification policy.

Annotations
@Override
forEachWithback to summary
public <P> void forEachWith(Procedure2<? super T, ? super P> procedure, P parameter)

The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.

Example using a Java 8 lambda:

people.forEachWith((Person person, Person other) ->
    {
        if (person.isRelatedTo(other))
        {
             LOGGER.info(person.getName());
        }
    }, fred);

Example using an anonymous inner class:

people.forEachWith(new Procedure2<Person, Person>()
{
    public void value(Person person, Person other)
    {
        if (person.isRelatedTo(other))
        {
             LOGGER.info(person.getName());
        }
    }
}, fred);
forEachWithIndexback to summary
public void forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)

Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.

Example using a Java 8 lambda:

people.forEachWithIndex((Person person, int index) -> LOGGER.info("Index: " + index + " person: " + person.getName()));

Example using an anonymous inner class:

people.forEachWithIndex(new ObjectIntProcedure<Person>()
{
    public void value(Person person, int index)
    {
        LOGGER.info("Index: " + index + " person: " + person.getName());
    }
});
Annotations
@Deprecated