Stream流操作-flatmap 【Java8-高级特性】


代码如下

String[] words = new String[]{"Hello","World"};
List a = Arrays.stream(words)
                .map(word -> word.split(""))
                .distinct()
                .collect(toList());
a.forEach(System.out::print);

Stream的运行流程如下

 转载自:https://blog.csdn.net/liyantianmin/article/details/96178586