MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / main

Method main

arrays/ParallelPrefix1.java:10–20  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

8
9public class ParallelPrefix1 {
10 public static void main(String[] args) {
11 int[] nums = new Count.Pint().array(10);
12 show(nums);
13 System.out.println(Arrays.stream(nums)
14 .reduce(Integer::sum).getAsInt());
15 Arrays.parallelPrefix(nums, Integer::sum);
16 show(nums);
17 System.out.println(Arrays.stream(
18 new Count.Pint().array(6))
19 .reduce(Integer::sum).getAsInt());
20 }
21}
22/* Output:
23[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

Callers

nothing calls this directly

Calls 4

showMethod · 0.65
arrayMethod · 0.45
getAsIntMethod · 0.45
streamMethod · 0.45

Tested by

no test coverage detected