File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed
src/main/java/lambdasinaction/chap6 Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ public class ParallelStreams {
66
77 public static long iterativeSum (long n ) {
88 long result = 0 ;
9- for (long i = 0 ; i < n ; i ++) {
9+ for (long i = 0 ; i <= n ; i ++) {
1010 result += i ;
1111 }
1212 return result ;
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ public class ParallelStreamsHarness {
88 public static final ForkJoinPool FORK_JOIN_POOL = new ForkJoinPool ();
99
1010 public static void main (String [] args ) {
11- System .out .println ("Iterative Sum done in: " + measurePerf (ParallelStreams ::sequentialSum , 10_000_000L ) + " msecs" );
11+ System .out .println ("Iterative Sum done in: " + measurePerf (ParallelStreams ::iterativeSum , 10_000_000L ) + " msecs" );
1212 System .out .println ("Sequential Sum done in: " + measurePerf (ParallelStreams ::sequentialSum , 10_000_000L ) + " msecs" );
1313 System .out .println ("Parallel forkJoinSum done in: " + measurePerf (ParallelStreams ::parallelSum , 10_000_000L ) + " msecs" );
1414 System .out .println ("Range forkJoinSum done in: " + measurePerf (ParallelStreams ::rangedSum , 10_000_000L ) + " msecs" );
You can’t perform that action at this time.
0 commit comments