lambda 生成笛卡尔集

public static void getDiKaEr() {
    List<List<String>> source = new ArrayList<>();
 List<String> color = Arrays.asList("红色", "白色", "蓝色");
 List<String> size = Arrays.asList("中", "大", "小");
 List<String> origins = Arrays.asList("中国", "瑞士");
 source.add(color);
 source.add(size);
 source.add(origins);
 List<String> result = source.stream().reduce((a, b) -> {
        List<String> results = new ArrayList<>();
 a.forEach(param1 -> {
            b.forEach(param2 -> {
                results.add(param1 + "-" + param2);
 });
 });
 return results;
 }).get();
 System.out.println(result);
}

docker docker docker ing

0 声望
0 粉丝
0 条评论

docker docker docker ing

0 声望
0 粉丝
宣传栏