Class ZipWithIndexIterable<T>

  • All Implemented Interfaces:
    java.lang.Iterable<Pair<T,​java.lang.Integer>>, InternalIterable<Pair<T,​java.lang.Integer>>, LazyIterable<Pair<T,​java.lang.Integer>>, RichIterable<Pair<T,​java.lang.Integer>>

    public class ZipWithIndexIterable<T>
    extends AbstractLazyIterable<Pair<T,​java.lang.Integer>>
    A CollectIterable is an iterable that transforms a source iterable on a condition as it iterates.
    • Field Detail

      • iterable

        private final java.lang.Iterable<T> iterable
    • Constructor Detail

      • ZipWithIndexIterable

        public ZipWithIndexIterable​(java.lang.Iterable<T> iterable)
    • Method Detail

      • iterator

        public java.util.Iterator<Pair<T,​java.lang.Integer>> iterator()
      • each

        public void each​(Procedure<? super Pair<T,​java.lang.Integer>> procedure)
        Description copied from interface: RichIterable
        The procedure is executed for each element in the iterable.

        Example using a Java 8 lambda expression:

         people.each(person -> LOGGER.info(person.getName()));
         

        Example using an anonymous inner class:

         people.each(new Procedure<Person>()
         {
             public void value(Person person)
             {
                 LOGGER.info(person.getName());
             }
         });
         
        This method is a variant of InternalIterable.forEach(Procedure) that has a signature conflict with Iterable.forEach(java.util.function.Consumer).
        See Also:
        InternalIterable.forEach(Procedure), Iterable.forEach(java.util.function.Consumer)