Class MappingJavaIterable<S,​T>

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

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

      • MappingJavaIterable

        public MappingJavaIterable​(Iterable<S> in,
                                   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 Iterator<T> iterator()
        Returns an iterator over elements of type T.
        Specified by:
        iterator in interface Iterable<S>
        Returns:
        an Iterator.