public static void main(String[] args) {
IntStream isa = IntStream.range(1, 101);
IntStream isb = IntStream.rangeClosed(1, 100);
System.out.println(isa.sum());
System.out.println(isb.sum());
Stream<Integer> is = Stream.of(1, 2, 3, 4, 5, 6, 7, 8);
//is.forEach(System.out::print);
is.filter(e -> e % 2 == 0).forEach(e -> System.out.printf("%d ", e));
System.out.println();
System.out.println("=============");
List<Integer> list = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
System.out.println(list);
Stream<
java17Lambda表达式和流与多线程的开启
于 2023-02-28 21:28:37 首次发布