19 Java 8 Stream并行计算原理
19.1 Java 8 Stream简介
19.2 Stream单线程串行计算
public class StreamDemo {
public static void main(String[] args) {
Stream.of(1, 2, 3, 4, 5, 6, 7, 8, 9)
.reduce((a, b) -> {
System.out.println(String.format("%s: %d + %d = %d",
Thread.currentThread().getName(), a, b, a + b));
return a + b;
})
.ifPresent(System.out::println);
}
}19.3 Stream多线程并行计算
19.4 从源码看Stream并行计算原理
19.5 Stream并行计算的性能提升
Last updated
Was this helpful?