public static <E> Iterator<Tuple2<Integer, E>> indexed(Iterator<E> self, int offset) {
        return new ZipPreIterator<E>(self, offset);
    }
public static < E > Iterator < Tuple2 < Integer , E > > indexed ( Iterator < E > self , int offset ) { return new ZipPreIterator < E > ( self , offset ) ; }
Zips an iterator with indices in (index, value) order.
<p/>
Example usage:
<pre class="groovyTestCase">
assert [[5, "a"], [6, "b"]] == ["a", "b"].iterator().indexed(5).toList()
assert ["a: 1", "b: 2"] == ["a", "b"].iterator().indexed(1).collect { idx, str {@code ->} "$str: $idx" }.toList()
</pre>

@param self   an iterator
@param offset an index to start from
@return a zipped iterator with indices
@see #withIndex(Iterator, int)
@since 2.4.0