zip5<T1, T2, T3, T4, T5> function

Iterable<Tuple5<T1, T2, T3, T4, T5>> zip5<T1, T2, T3, T4, T5>(
  1. Iterable<T1> it1,
  2. Iterable<T2> it2,
  3. Iterable<T3> it3,
  4. Iterable<T4> it4,
  5. Iterable<T5> it5,
)

Implementation

Iterable<Tuple5<T1, T2, T3, T4, T5>> zip5<T1, T2, T3, T4, T5>(
    Iterable<T1> it1,
    Iterable<T2> it2,
    Iterable<T3> it3,
    Iterable<T4> it4,
    Iterable<T5> it5) sync* {
  final iter1 = it1.iterator;
  final iter2 = it2.iterator;
  final iter3 = it3.iterator;
  final iter4 = it4.iterator;
  final iter5 = it5.iterator;
  var keep_running = true;
  while (keep_running) {
    final move1 = iter1.moveNext();
    final move2 = iter2.moveNext();
    final move3 = iter3.moveNext();
    final move4 = iter4.moveNext();
    final move5 = iter5.moveNext();
    final all_true = move1 && move2 && move3 && move4 && move5;
    final all_false = !move1 && !move2 && !move3 && !move4 && !move5;
    assert((all_true || all_false), 'iteration length must be equal');
    if (all_true) {
      yield Tuple5<T1, T2, T3, T4, T5>(iter1.current, iter2.current,
          iter3.current, iter4.current, iter5.current);
    }
    keep_running = all_true;
  }
}