unzip method Null safety

KtPair<KtList<T>, KtList<R>> unzip()

Returns a pair of lists, where first list is built from the first values of each pair from this collection, second list is built from the second values of each pair from this collection.

Implementation

KtPair<KtList<T>, KtList<R>> unzip() {
  final listT = KtMutableList<T>.empty();
  final listR = KtMutableList<R>.empty();
  for (final pair in iter) {
    listT.add(pair.first);
    listR.add(pair.second);
  }
  return KtPair(listT, listR);
}