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";
//找出最长的单词
Optional<String> maxLongWord = Stream.of(words).map(word -> word.split(" ")).flatMap(Stream::of).collect(Collectors.maxBy(Comparator.comparing(String::length)));
System.out.println(maxLongWord.get());