java8/Java8InAction

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

Opened this issue · 0 comments

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