Class TransformedIterator<S,​T>

  • Type Parameters:
    S - The source element type
    T - The target element type
    All Implemented Interfaces:
    Iterator<T>

    public class TransformedIterator<S,​T>
    extends Object
    implements Iterator<T>
    An iterator that transforms each element upon iteration
    • Constructor Detail

      • TransformedIterator

        public TransformedIterator​(Iterator<S> delegate,
                                   Function<S,​T> transformer)
    • Method Detail

      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface Iterator<S>
      • next

        public T next()
        Specified by:
        next in interface Iterator<S>