File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
src/main/java/lambdasinaction/chap5 Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public static void main(String ... args) {
1717 }
1818
1919 public static Map <Boolean , List <Integer >> partitionPrimes (int n ) {
20- return Stream .iterate (2 , i -> i + 1 ).limit (n )
20+ return Stream .iterate (2 , i -> i + 1 ).limit (n - 1 )
2121 .collect (partitioningBy (candidate -> isPrime (candidate )));
2222 }
2323
@@ -28,7 +28,7 @@ public static boolean isPrime(int candidate) {
2828 }
2929
3030 public static Map <Boolean , List <Integer >> partitionPrimesWithCustomCollector (int n ) {
31- return Stream .iterate (2 , i -> i + 1 ).limit (n ).collect (new PrimeNumbersCollector ());
31+ return Stream .iterate (2 , i -> i + 1 ).limit (n - 1 ).collect (new PrimeNumbersCollector ());
3232 }
3333
3434 public static boolean isPrime (List <Integer > primes , Integer candidate ) {
You can’t perform that action at this time.
0 commit comments