moveNext method

bool moveNext ()
override

Moves to the next element.

Returns true if current contains the next element. Returns false if no elements are left.

It is safe to invoke moveNext even when the iterator is already positioned after the last element. In this case moveNext returns false again and has no effect.

A call to moveNext may throw if iteration has been broken by changing the underlying collection.

Implementation

bool moveNext() {
  if (_iterator.moveNext()) {
    _current = new IndexedValue(_index++, _iterator.current);
    return true;
  }
  _current = null;
  return false;
}