zip method

Iterable<(T1, T2)> zip()

Combines the tuple of iterables to an iterable of tuples. The resulting iterable has the length of the shortest input iterable.

For example, the following expression

([1, 2],  ['a', 'b']).zip();

yields

[(1, 'a'), (2, 'b')]

Implementation

Iterable<(T1, T2)> zip() sync* {
  final i1 = $1.iterator, i2 = $2.iterator;
  while (i1.moveNext() && i2.moveNext()) {
    yield (i1.current, i2.current);
  }
}