zip<T> function

Iterable<List<T>> zip <T>(Iterable<Iterable<T>> iterables)

Returns an Iterable of Lists where the nth element in the returned iterable contains the nth element from every Iterable in iterables. The returned Iterable is as long as the shortest Iterable in the argument. If iterables is empty, it returns an empty list.


Iterable<List<T>> zip<T>(Iterable<Iterable<T>> iterables) sync* {
  if (iterables.isEmpty) return;
  final iterators = => e.iterator).toList(growable: false);
  while (iterators.every((e) => e.moveNext())) {
    yield => e.current).toList(growable: false);