Class DelegatedIterator<T,​R>

  • Type Parameters:
    T - the type of elements returned by the delegated iterator
    R - the type of elements returned by this iterator
    All Implemented Interfaces:
    Iterator<R>

    @ParametersAreNonnullByDefault
    public class DelegatedIterator<T,​R>
    extends Object
    implements Iterator<R>
    An Iterator that iterates over another.
    • Constructor Detail

      • DelegatedIterator

        public DelegatedIterator​(Iterator<T> delegate,
                                 Function<T,​R> mappingFunction)
        Constructs a new DelegatedIterator.
        Parameters:
        delegate - the delegated iterator
        mappingFunction - the function used to map elements from the delegate
    • Method Detail

      • hasNext

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

        public R next()
        Specified by:
        next in interface Iterator<T>
      • remove

        public void remove()
        Specified by:
        remove in interface Iterator<T>