最具挑战性的挑战莫过于提升自我。——迈克尔·F·斯特利
Java9和Java16中更新了Stream中的函数
| 
 
 List<Integer> collect = Stream.iterate(0, i -> i < 100, i -> ++i).toList();
 System.out.println("iterate&toList:" + collect);
 
 
 System.out.print("takeWhile:");
 collect.parallelStream().takeWhile(i -> i < 66).forEach(obj -> System.out.print(obj + " "));
 System.out.println();
 
 
 List<Integer> drop = collect.parallelStream().dropWhile(i -> i < 66).toList();
 System.out.println("dropWhile" + drop);
 
 
 
 Stream.ofNullable(null);
 Stream.of("");
 
 
 
 Stream.of("1", "2").mapMulti((a, b) -> b.accept(a + "0")).forEach(System.out::print);
 System.out.println();
 
 Stream.of(1, 2).mapMultiToInt((a, b) -> b.accept(a + 1)).forEach(System.out::print);
 System.out.println();
 
 Stream.of("1", "2").mapMultiToLong((a, b) -> b.accept(8L)).forEach(System.out::print);
 System.out.println();
 
 Stream.of(1, 2).mapMultiToDouble((a, b) -> b.accept(a - 1)).forEach(obj -> System.out.print(obj + " "));
 
 | 
控制台打印结果
