zip3<A, B, C> function

List<(A, B, C)> zip3<A, B, C>(
  1. List<A> a,
  2. List<B> b,
  3. List<C> c
)

Zips three lists a, b, and c into a list of (A, B, C) records, truncated to the shortest list.

Implementation

List<(A, B, C)> zip3<A, B, C>(List<A> a, List<B> b, List<C> c) {
  final n = math.min(a.length, math.min(b.length, c.length));
  return List<(A, B, C)>.generate(n, (i) => (a[i], b[i], c[i]));
}