Skip to content

IListTuple2UnzipOps<A, B>

extension IListTuple2UnzipOps<A, B> on IList<Record>

Methods

unzip() extension

Record unzip()

Returns 2 new lists as a tuple. The first list is all the first items from each tuple element of this list. The second list is all the second items from each tuple element of this list.

Available on IList<A>, provided by the IListTuple2UnzipOps<A, B> extension

Implementation
dart
(IList<A>, IList<B>) unzip() =>
    foldLeft((nil<A>(), nil<B>()), (acc, ab) => (acc.$1.appended(ab.$1), acc.$2.appended(ab.$2)));