zip<B> method

  1. @override
IList<(A, B)> zip<B>(
  1. RIterableOnce<B> that
)
override

Returns a new collection that combines corresponding elements from this collection and that as a tuple. The length of the returned collection will be the minimum of this collections size and the size of that.

Implementation

@override
IList<(A, B)> zip<B>(RIterableOnce<B> that) {
  final b = builder<(A, B)>();
  final it1 = iterator;
  final it2 = that.iterator;

  while (it1.hasNext && it2.hasNext) {
    b.addOne((it1.next(), it2.next()));
  }

  return b.toIList();
}