currentIndex

open fun currentIndex(): Int(source)

Returns the index of the element that was returned by the most recent call to next or previous.

This method can be called multiple times without side effects - it will always return the same value until the next call to next, previous, or remove.

Important: If neither next nor previous has been called yet, or if remove was called after the last call to next or previous, this method returns -1.

Note: In the legacy ArrayIterator class, this method was named index(). It has been renamed to currentIndex() for better clarity and consistency.

Return

the index of the current element, or -1 if no element has been read or the current element was removed