About Question enthuware.ocpjp.ii.v11.2.3322 :
Posted: Mon Aug 12, 2019 2:09 pm
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 in Enthuware last option that is wrong:
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: Select all
Set<String> newBooks = books
.stream()
.collect(Collectors.filtering(p, Collectors.mapping(Book::getTitle, Collectors.toSet()));