I would like to have a clean recursive function to generate the same result than
static List<String> l, out;
l=new ArrayList<String>();
l.add("A");l.add("B");l.add("C");l.add("D");l.add("E");l.add("F");
for (int i = 0; i < l.size(); i++) {
for (int j = i+1; j < l.size(); j++) {
for (int k = j+1; k < l.size(); k++) {
for (int t = k+1; t < l.size(); t++) {
StringBuffer buffer = new StringBuffer(50);
buffer.append(l.get(i));
buffer.append(l.get(j));
buffer.append(l.get(k));
buffer.append(l.get(t));
out.add(buffer.toString());
}
}
}
}
here there are 4 levels for example
I gave one try there http://pastebin.com/auSxQMHt
but it's not working (see the output, I don't get as many results)
thx