public static <T> Iterator<Pair<Integer, T>> counted(T... array) {
        dbc.precondition(array != null, "cannot call counted with a null array");
        final SequencingPolicy<Integer> sequencer = new NextIntegerSequencingPolicy();
        final Comparator<Optional<Integer>> comparator = new JustBeforeNothingComparator<Integer>(new ComparableComparator<Integer>());
        final Range<Integer> range = new DenseRange<Integer>(sequencer, comparator, Endpoint.Include, 0, Optional.of(Integer.MAX_VALUE), Endpoint.Include);
        return new ZipShortestIterator<Integer, T>(range.iterator(), new ArrayIterator<T>(array));
    }
public static < T > Iterator < Pair < Integer , T > > counted ( T ... array ) { dbc . precondition ( array != null , "cannot call counted with a null array" ) ; final SequencingPolicy < Integer > sequencer = new NextIntegerSequencingPolicy ( ) ; final Comparator < Optional < Integer > > comparator = new JustBeforeNothingComparator < Integer > ( new ComparableComparator < Integer > ( ) ) ; final Range < Integer > range = new DenseRange < Integer > ( sequencer , comparator , Endpoint . Include , 0 , Optional . of ( Integer . MAX_VALUE ) , Endpoint . Include ) ; return new ZipShortestIterator < Integer , T > ( range . iterator ( ) , new ArrayIterator < T > ( array ) ) ; }
Creates an iterator yielding values from the source iterator and its
index.

<code>E.g:
counted(["a", "b","c"]) -> [(0,"a"), (1, "b"), (2, "c")]
</code>

@param <T> the element type
@param array the source array
@return the resulting iterator