fun <T1, T2> Iterable<T1>.cartesianProduct(other: Iterable<T2>): Set<Pair<T1, T2>>

Creates cartesian product between all the elements from this and other iterable. E.g. when this contains 1,2,3 and other contains 'a', 'b', the result will be {Pair(1,'a'), Pair(1,'b'), Pair(2,'a'), Pair(2,'b'), Pair(3,'a'), Pair(3,'b')}.

fun <T> Iterable<Iterable<T>>.cartesianProduct(): List<List<T>>

List cartesian production.

See also



Link copied to clipboard
Link copied to clipboard