zipPartialWith method

Iterable<(T1, T2)> zipPartialWith(
  1. (T1, T2) padding
)

Combines the tuple of iterables to an iterable of tuples. The resulting iterable has the length of the longest input iterable, missing values are padded with padding.

Implementation

Iterable<(T1, T2)> zipPartialWith((T1, T2) padding) sync* {
  final i1 = $1.iterator, i2 = $2.iterator;
  for (;;) {
    final h1 = i1.moveNext(), v1 = h1 ? i1.current : padding.$1;
    final h2 = i2.moveNext(), v2 = h2 ? i2.current : padding.$2;
    if (h1 || h2) {
      yield (v1, v2);
    } else {
      return;
    }
  }
}