zip<R> method

List<(T, R)> zip<R>(
  1. Iterable<R> other
)

Pairs elements with other, stopping at the shorter iterable.

Implementation

List<(T, R)> zip<R>(Iterable<R> other) {
  final it = other.iterator;
  final result = <(T, R)>[];
  for (final element in this) {
    if (!it.moveNext()) break;
    result.add((element, it.current));
  }
  return result;
}