Hi guys!
Just a quick problem I have here. Basically I have an ArrayList of ArrayLists of some object. So it would look something like this:
[ [1,2,3], [4], [5,6,7,8,9], [10,11] ]
Now I want to get every possible combination of elements, selecting at least one from each arraylist. So I'd need:
[1,4,5,10], [1,4,5,11], [1,4,6,10], [1,4,6,11].... [3,4,9,11]
But my problem is that I could have any number of ArrayLists in the ArrayList, containing any number of elements, so a simple combination of for loops won't work. I was hoping there might be a method in the API which multiplies out every possible combination of elements in an ArrayList, but there doesn't appear to be.
I wonder if I'm just being a bit dim, but it's been giving me a headache for days. Does anyone have any ideas? Or am I heading down a bit of a dead end
Thanks for your time and help
Mike
[ March 03, 2005: Message edited by: Mike Smike ]