日期:2014-05-20 浏览次数:20621 次
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class Hello {
private static List<String> result = new ArrayList<String>();
public static void foo(List<List<String>> lists, int outerIndex) {
if (result.size() == lists.size()) {
System.out.println(result);
}
for (int oi = outerIndex; oi < lists.size(); ++oi) {
List<String> temp = lists.get(oi);
for (int ii = 0; ii < temp.size(); ++ii) {
result.add(temp.get(ii));
foo(lists, oi + 1);
result.remove(result.size() - 1);
}
}
}
public static void main(String[] args) {
// [[[1]]] 准备数据.
List<String> l1 = new ArrayList<String>();