流的扁平化flatMap
package com.ant.jdk8.chap05; import java.util.Arrays; import java.util.List; public class StreamMapDemo { public static void main(String[] args) { List<String> words = Arrays.asList("Hello","World"); words.stream() .map(word->word.split("")) .flatMap(Arrays::stream) .distinct().forEach(System.out::print); } }
posted on 2018-09-03 20:20 shammgod_code 阅读(132) 评论(0) 编辑 收藏 举报