📜  java 8 流添加到列表 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:16.108000             🧑  作者: Mango

代码示例1
List destList = Arrays.asList("foo");
List newList = Arrays.asList("0", "1", "2", "3", "4", "5");

destList = Stream.concat(destList.stream(), newList.stream()).parallel()
            .collect(Collectors.toList());
System.out.println(destList);

//output: [foo, 0, 1, 2, 3, 4, 5]