public interface InternalIterable<T> extends Iterable<T>
Modifier and Type | Method and Description |
---|---|
void |
forEach(Procedure<? super T> procedure)
The procedure is executed for each element in the iterable.
|
<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.
|
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
|
forEach, iterator, spliterator
void forEach(Procedure<? super T> procedure)
e.g. people.forEach(new Procedure() { public void value(Person person) { LOGGER.info(person.getName()); } });
void forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)
e.g. people.forEachWithIndex(new ObjectIntProcedure() { public void value(Person person, int index) { LOGGER.info("Index: " + index + " person: " + person.getName()); } });
<P> void forEachWith(Procedure2<? super T,? super P> procedure, P parameter)
e.g. people.forEachWith(new Procedure2() { public void value(Person person, Person other) { if (person.isRelatedTo(other)) { LOGGER.info(person.getName()); } } }, fred);
Copyright © 2004–2019. All rights reserved.