Class MappingJavaIterable<S,​T>

  • Type Parameters:
    S - the type of the input items
    T - the type of the delivered item
    All Implemented Interfaces:
    java.lang.Iterable<T>

    public class MappingJavaIterable<S,​T>
    extends java.lang.Object
    implements java.lang.Iterable<T>
    A Java Iterable which applies a mapping function to each item in a supplied Iterable
    • Constructor Summary

      Constructors 
      Constructor Description
      MappingJavaIterable​(java.lang.Iterable<S> in, java.util.function.Function<S,​T> mapper)
      Create a mapping iterable
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Iterator<T> iterator()
      Returns an iterator over elements of type T.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • MappingJavaIterable

        public MappingJavaIterable​(java.lang.Iterable<S> in,
                                   java.util.function.Function<S,​T> mapper)
        Create a mapping iterable
        Parameters:
        in - the input sequence
        mapper - the mapping function to be applied to each item in the input sequence to generate the corresponding item in the result sequence. If the mapping function returns null for a particular input, the item is omitted from the result sequence.
    • Method Detail

      • iterator

        public java.util.Iterator<T> iterator()
        Returns an iterator over elements of type T.
        Specified by:
        iterator in interface java.lang.Iterable<S>
        Returns:
        an Iterator.