Carey Brown wrote:This works, whereas Piet's solution only seems to be a partial solution or a solution that doesn't answer the original post's requirements. (...)
Ahh, indeed, completely misread the problem... sorry for that!
I do have a somewhat aging solution that uses streams. We had a topic some time ago about getting all sublists of a list, and I can't remember who it was, but that someone produced a solution with Suppliers. If I can find that topic, I will have a look if I can incorporate some of that solution. My Stream version (with an added method to convert an int[][] to a List<List>>) with the disadvantage that it produces quite some Lists on the way. The 1D arrays may be of any length:
As an alternative:
if we have T arrays, with length t0, t1, t2, ... then we have as outcome N = t0 * t1 * ... arrays (or Lists). So we can run a loop from 0 to N-1, with 0 meaning pick fro every array the 0th element, 1 meaning pick from every array the 0th element, but element 1 from the last array, et cetera. So in fact we express every number X in a number with the explained base, and so we can directly calculate the result involved. For the true enthousiast!