java 8 stream add to list

Solutions on MaxInterview for java 8 stream add to list by the best coders in the world

showing results for - "java 8 stream add to list"
Henri
18 Oct 2018
1List<String> destList = Arrays.asList("foo");
2List<String> newList = Arrays.asList("0", "1", "2", "3", "4", "5");
3
4destList = Stream.concat(destList.stream(), newList.stream()).parallel()
5            .collect(Collectors.toList());
6System.out.println(destList);
7
8//output: [foo, 0, 1, 2, 3, 4, 5]