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, ...):
12,13,14,21,31,41,23,24,32,34,42,43,
123,...,
...,4321
I think I can handle duplicates by using a data structure which will just not allow you duplicates. Something like this maybe?