Page 1 of 1

About Question enthuware.ocpjp.ii.v11.2.3322 :

Posted: Mon Aug 12, 2019 2:09 pm
by BinSlayer
Hi
The last option should work. At least it should work semantically.
Yes, after trying to execute the code I did notice that a parenthesis was missing ) . But after you fix the parenthesis it just outputs the same as the first 2 choices.
But I believe we can't possible be expected to look for parenthesis in the OCP exam, right? Am I wrong to believe so?
See what I mean below:

Code that works:

Code: Select all

Set<String> newBooks = books
            .stream()
            .collect(Collectors.filtering(p, Collectors.mapping(Book::getTitle, Collectors.toSet())));
Code in Enthuware last option that is wrong:

Code: Select all

Set<String> newBooks = books
            .stream()
            .collect(Collectors.filtering(p, Collectors.mapping(Book::getTitle, Collectors.toSet()));

Re: About Question enthuware.ocpjp.ii.v11.2.3322 :

Posted: Mon Aug 12, 2019 11:50 pm
by admin
No, you are absolutely correct. Parenthesis is not the criteria here. The last option should also be correct. Fixed.
thank you for your feedback!
Paul.