java8 / Java8InAction

MIT License
3.18k stars 2.26k forks source link

the class PartitionPrimeNumbers has an error at line 36 and don't compile #16

Open wilsonpenha opened 7 years ago

wilsonpenha commented 7 years ago
public static boolean isPrime(List<Integer> primes, Integer candidate) {
    double candidateRoot = Math.sqrt((double) candidate);
    //return takeWhile(primes, i -> i <= candidateRoot).stream().noneMatch(i -> candidate % i == 0);
    return primes.stream().**takeWhile**(i -> i <= candidateRoot).noneMatch(i -> candidate % i == 0);
}

-> the function takeWhile is invalid or doesn't exists