Concurrency, Multithreading, Java, Programming, Software Development.
System.out.println("Sum using ForkJoinPool: " + sum); // Using parallel stream for parallel computation sum = Arrays.stream(array).parallel().sum(); System.out.println("Sum using parallel stream: " + sum); } } In this example: SumTask is a RecursiveTask that recursively computes the sum of an array