cartesian<U> method

  1. @useResult
Iterable<(T, U)> cartesian<U>(
  1. Iterable<U> other
)

Cartesian product: all pairs (a, b) for a in this, b in other.

Implementation

@useResult
Iterable<(T, U)> cartesian<U>(Iterable<U> other) sync* {
  final List<T> thisList = toList();
  final List<U> otherList = other.toList();
  for (final T a in thisList) {
    for (final U b in otherList) {
      yield (a, b);
    }
  }
}