enumerate method

Iterable<(int, E)> enumerate()

Models the Python enumerate function. Returns a new iterable of tuples where the first element is the index and the second element is the value.

Implementation

Iterable<(int, E)> enumerate() sync* {
  final Iterator<E> iterator = this.iterator;
  int index = 0;
  while (iterator.moveNext()) {
    yield (index++, iterator.current);
  }
}