unzip2<A, B> function

(List<A>, List<B>) unzip2<A, B>(
  1. List<(A, B)> pairs
)

Splits pairs into two lists: first elements and second elements.

Implementation

(List<A>, List<B>) unzip2<A, B>(List<(A, B)> pairs) {
  final List<A> a = <A>[];
  final List<B> b = <B>[];
  for (final (A x, B y) in pairs) {
    a.add(x);
    b.add(y);
  }
  return (a, b);
}