Package org.eclipse.collections.api
Interface InternalIterable<T>
- All Superinterfaces:
Iterable<T>
- All Known Subinterfaces:
Bag<T>,BiMap<K,,V> ByteObjectMap<V>,CharObjectMap<V>,ConcurrentMutableMap<K,,V> DoubleObjectMap<V>,FixedSizeCollection<T>,FixedSizeList<T>,FixedSizeMap<K,,V> FixedSizeSet<T>,FloatObjectMap<V>,ImmutableBag<T>,ImmutableBagIterable<T>,ImmutableBiMap<K,,V> ImmutableByteObjectMap<V>,ImmutableCharObjectMap<V>,ImmutableCollection<T>,ImmutableDoubleObjectMap<V>,ImmutableFloatObjectMap<V>,ImmutableIntObjectMap<V>,ImmutableList<T>,ImmutableLongObjectMap<V>,ImmutableMap<K,,V> ImmutableMapIterable<K,,V> ImmutableOrderedMap<K,,V> ImmutablePrimitiveObjectMap<V>,ImmutableSet<T>,ImmutableSetIterable<T>,ImmutableShortObjectMap<V>,ImmutableSortedBag<T>,ImmutableSortedMap<K,,V> ImmutableSortedSet<T>,ImmutableStack<T>,IntObjectMap<V>,LazyIterable<T>,ListIterable<T>,LongObjectMap<V>,MapIterable<K,,V> MultiReaderBag<T>,MultiReaderList<T>,MultiReaderSet<T>,MutableBag<T>,MutableBagIterable<T>,MutableBiMap<K,,V> MutableByteObjectMap<V>,MutableCharObjectMap<V>,MutableCollection<T>,MutableDoubleObjectMap<V>,MutableFloatObjectMap<V>,MutableIntObjectMap<V>,MutableList<T>,MutableLongObjectMap<V>,MutableMap<K,,V> MutableMapIterable<K,,V> MutableOrderedMap<K,,V> MutablePrimitiveObjectMap<V>,MutableSet<T>,MutableSetIterable<T>,MutableShortObjectMap<V>,MutableSortedBag<T>,MutableSortedMap<K,,V> MutableSortedSet<T>,MutableStack<T>,OrderedIterable<T>,OrderedMap<K,,V> PrimitiveObjectMap<V>,ReversibleIterable<T>,RichIterable<T>,SetIterable<T>,ShortObjectMap<V>,SortedBag<T>,SortedIterable<T>,SortedMapIterable<K,,V> SortedSetIterable<T>,StackIterable<T>,UnsortedBag<T>,UnsortedMapIterable<K,,V> UnsortedSetIterable<T>
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 TypeMethodDescriptiondefault voidvoidThe procedure is executed for each element in the iterable.<P> voidforEachWith(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.voidforEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure) Deprecated.in 6.0.Methods inherited from interface java.lang.Iterable
iterator, spliterator
-
Method Details
-
forEach
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 withIterable.forEach(java.util.function.Consumer)since Java 1.8. It is recommended to useRichIterable.each(Procedure)instead to avoid casting to Procedure. -
forEach
-
forEachWithIndex
Deprecated.in 6.0. UseOrderedIterable.forEachWithIndex(ObjectIntProcedure)instead.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()); } }); -
forEachWith
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);
-