Given n arrays of random sizes, I need to permute them like this:
[a1, a2, a3]
[b1, b2]
[c1, c2]
[a1, b1, c1]
[a1, b1, c2]
[a1, b2, c1]
[a1, b2, c2]
[a2, b1, c1]
[a2, b1, c2]
[a2, b2, c1]
[a2, b2, c2]
[a3, b1, c1]
[a3, b1, c2]
[a3, b2, c1]
[a3, b2, c2]
The columns order matters, lines dont.
What is good way to achieve this. If possible, using this method contract:
<T> List<List<T>> permute(List<T>... lists)