Given an unknown amount of lists, each with an unknown length, I need to generate a singular list with all possible unique combinations.
For example, given the following lists:
X: [A, B, C]
Y: [W, X, Y, Z]
Then I should be able to generate 12 combinations:
[AW, AX, AY, AZ, BW, BX, BY, BZ, CW, CX, CY, CZ]
If a third list of 3 elements were added, I'd have 36 combinations, and so forth.
Any ideas on how I can do this in Java?
(pseudo code would be fine too)
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…