mapIndexed<T, R> function

Iterable<R> mapIndexed <T, R>(
  1. Iterable<T> list,
  2. R f(
    1. int index,
    2. T val
    )
)

Implementation

Iterable<R> mapIndexed<T, R>(Iterable<T> list, R f(int index, T val)) sync* {
  int i = 0;
  for (T val in list) {
    yield f(i++, val);
  }
}