zip<R> method
Pairs each element with the element at the same position in other.
The result length is the shorter of the two iterables.
Example:
['a', 'b'].zip([1, 2, 3]); // [('a', 1), ('b', 2)]
Implementation
List<(E, R)> zip<R>(Iterable<R> other) {
final Iterator<E> a = iterator;
final Iterator<R> b = other.iterator;
final List<(E, R)> result = <(E, R)>[];
while (a.moveNext() && b.moveNext()) {
result.add((a.current, b.current));
}
return result;
}