Not really a Java specific question, I know.
Given a set of something, how do I generate all combinations? Is this a smart way of doing this? My first attempt to would be to have a bunch of loops, I guess.
Example input: 1,2,3,4
Desired output (all pairs, all triplets, ...):
I think I can handle duplicates by using a data structure which will just not allow you duplicates. Something like this maybe?