1z0-819 Exam QuestionsBrowse all questions from this exam

1z0-819 Exam - Question 86


Given:

and the code fragment:

Which two Map objects group all employees with a salary greater than 30 by neighborhood? (Choose two.)

Show Answer
Correct Answer: AC

To group all employees with a salary greater than 30 by neighborhood, we need to use both the predicate to filter the employees and the function/method to group by neighborhood. The correct options are those that correctly implement these functionalities without syntax errors. 'A' uses the function 'f' to group and the predicate 'p' to filter while 'C' uses 'getNeighborhood' to group and the predicate 'p' to filter. Both of these implementations are correct and compile without issues.

Discussion

9 comments
Sign in to comment
dillemanOptions: AC
Oct 4, 2023

If you think about it this makes sence without knowing too much about the exact syntax. A: We use the function f to group and the predicate p to filter. This is correct. B: We use the predicate p both to filter and group. This does not compile since groping does not take a predicate. C: We use the getNeighborhood-method to group and the predicate to filter. This is correct. D: We correctly use the predicate to filter but use both the function and the getNeighborhood to group and this method is already defined in the function. This does not look correct with double grouping on that method. E: This is a copy of C but with extra parentheses in the end and this does not compile.

RoxyFoxy
Oct 24, 2023

Your explanation is brilliant! Thank you, dilleman!

SampsOptions: AC
Dec 28, 2023

correct answers are A and C

tmuralimanoharOption: C
Jun 29, 2023

Answer: C

[Removed]
Aug 30, 2023

A & B are correct

OmnisumemOption: A
Sep 11, 2023

Tested: A.

Omnisumem
Sep 11, 2023

And maybe C - if we need two correct answers...

[Removed]Option: A
Sep 27, 2023

Tested, A and C.

mendjijetOption: D
Feb 9, 2024

Correct are A and D Tested C and E does not compile because their provide a Map<String, List<Employee>> not Map<Optional<String>, List<employee>> B is not correct

ASPushkinOption: C
Jul 2, 2024

same as 210 answer: A, C

ASPushkin
Jul 3, 2024

tested D uses function f() with Optional but left site uses directly String - not compiled