Class IndexingIterator<In>

  • Type Parameters:
    In - The input iterator type
    All Implemented Interfaces:
    Iterator<Index<In>>

    public class IndexingIterator<In>
    extends Object
    implements Iterator<Index<In>>
    An iterator that keeps track of its index, allowing you to get the current element count.
    • Constructor Detail

      • IndexingIterator

        public IndexingIterator​(Iterator<? extends In> input)
        Wrapper constructor
        Parameters:
        input - The input iterator
    • Method Detail

      • remove

        public void remove()
        Removes the current item from the list and decrements the index.

        The next item returned will have the same index as the previous one. If the wrapped iterator does not support removals, this method will throw an appropriate exception without decrementing the counter.

        Specified by:
        remove in interface Iterator<In>