edd99881d7
Also removed Preferences appendix
24 lines
638 B
Java
24 lines
638 B
Java
// concurrent/Summing4.java
|
|
// (c)2017 MindView LLC: see Copyright.txt
|
|
// We make no guarantees that this code is fit for any purpose.
|
|
// Visit http://OnJava8.com for more book information.
|
|
// {ValidateByHand} CI has trouble
|
|
import java.util.*;
|
|
|
|
public class Summing4 {
|
|
public static void main(String[] args) {
|
|
System.out.println(Summing3.CHECK);
|
|
Long[] aL = new Long[Summing3.SZ+1];
|
|
Arrays.parallelSetAll(aL, i -> (long)i);
|
|
Summing.timeTest("Long Parallel",
|
|
Summing3.CHECK, () ->
|
|
Arrays.stream(aL)
|
|
.parallel()
|
|
.reduce(0L,Long::sum));
|
|
}
|
|
}
|
|
/* Output:
|
|
50000005000000
|
|
Long Parallel: 1014ms
|
|
*/
|