About Question enthuware.ocpjp.v8.2.1901 :
Posted: Fri Mar 13, 2020 2:57 am
In need of help on the following question ?
Given:
List<Integer> primes = Arrays.asList(2, 3, 5, 7, 11, 13, 17); //1
Stream<Integer> primeStream = primes.stream(); //2
Predicate<Integer> test1 = k->k<10; //3
the given answer on the enthuware mockExam says the correct answer is as follows .
primeStream.collect(Collectors.partitioningBy(test1,Collectors.counting())).values().forEach(System.out::print)
can you make a method call like values() on a terminal operator like the callect() method ? does it even compile ?
Given:
List<Integer> primes = Arrays.asList(2, 3, 5, 7, 11, 13, 17); //1
Stream<Integer> primeStream = primes.stream(); //2
Predicate<Integer> test1 = k->k<10; //3
the given answer on the enthuware mockExam says the correct answer is as follows .
primeStream.collect(Collectors.partitioningBy(test1,Collectors.counting())).values().forEach(System.out::print)
can you make a method call like values() on a terminal operator like the callect() method ? does it even compile ?