流的扁平化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 阅读(155) 评论(0) 收藏 举报
浙公网安备 33010602011771号