zip<TOther> method

Iterable<Tuple<TValue?, TOther?>> zip<TOther>(
  1. Iterable<TOther> other
)

Merges every element of this Iterable with the corresponding element of other into a Tuple.

If this and other have varying lengths, null will be substituted for the missing counter part in the result Tuple.

Implementation

Iterable<Tuple<TValue?, TOther?>> zip<TOther>(Iterable<TOther> other) {
  return Iterable.generate(
      math.max(length, other.length),
      (i) => Tuple(length > i ? elementAt(i) : null,
          other.length > i ? other.elementAt(i) : null));
}