Return all permutations of values of an array of arrays
Return all permutations of values of an array of arrays
e.g.: scala> permutations(Array(Array(1,2,3), Array(1,2,3), Array(1,2))).map{ _.mkString(",") }.foreach{println} 1,1,1 1,1,2 1,2,1 1,2,2 1,3,1 1,3,2 2,1,1 2,1,2 2,2,1 2,2,2 2,3,1 2,3,2 3,1,1 3,1,2 3,2,1 3,2,2 3,3,1 3,3,2
Retain Ordering = false:
1,1,1 2,1,1 3,1,1 1,2,1 2,2,1 3,2,1 1,3,1 2,3,1 3,3,1 1,1,2 2,1,2 3,1,2 1,2,2 2,2,2 3,2,2 1,3,2 2,3,2 3,3,2
http://stackoverflow.com/questions/5751091/permutations-of-an-array-of-arrays-of-strings
(Since version ) see corresponding Javadoc for more information.