(String[] args)
| 19 | public static final long CHECK = |
| 20 | (long)SZ * ((long)SZ + 1)/2; |
| 21 | public static void main(String[] args) { |
| 22 | System.out.println(CHECK); |
| 23 | Long[] aL = new Long[SZ+1]; |
| 24 | Arrays.parallelSetAll(aL, i -> (long)i); |
| 25 | Summing.timeTest("Long Array Stream Reduce", |
| 26 | CHECK, () -> |
| 27 | Arrays.stream(aL).reduce(0L, Long::sum)); |
| 28 | Summing.timeTest("Long Basic Sum", CHECK, () -> |
| 29 | basicSum(aL)); |
| 30 | // Destructive summation: |
| 31 | Summing.timeTest("Long parallelPrefix",CHECK, ()-> { |
| 32 | Arrays.parallelPrefix(aL, Long::sum); |
| 33 | return aL[aL.length - 1]; |
| 34 | }); |
| 35 | } |
| 36 | } |
| 37 | /* Output: |
| 38 | 50000005000000 |
nothing calls this directly
no test coverage detected