Java Lambda 统计共有多少个单词
String words = "If you miss the train I'm on You will know that I am gone You can hear the whistle blow a hundred miles A hundred miles a hundred miles";
//统计共有多少个单词
long wordCount = Stream.of(words).map(word -> word.split(" ")).flatMap(Stream::of).count();
System.out.println(wordCount);