I am having difficulty creating some general for loops on my own (my code is in java). Imagine I have M number of arraylists of strings that each arraylist s_i has x_i members. I want to generate all possible strings such that the first part of string is from first set, the second part of string is from second set and ...
For example, below, there are 3 lists (which is unknown at time of programming):
|s_0| = x_0 = 3: [a1, a2, a3]
|s_1| = x_1 = 5: [b1, b2, b3, b4, b5]
|s_2| = x_2 = 2: [c1, c2]
I want to generate these strings (order is not important):
strings: ["a1 b1 c1", "a1 b1 c2", "a1 b2 c1", ...., "a3 b5 c2"]