Oracle
1Z0-819 · Question #64
1Z0-819 Question #64: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-819 to reveal the answer and full explanation for question #64. The question stem and answer options stay visible for context.
Question
Given
public class Employee {
private String name;
private LocalDate birthday;
// the constructors, getters, and setters methods go here
}
and
List<Employee> roster = new ArrayList<>();
// ...
Predicate<Employee> p = (Employee e) -> e.getBirthday().
isBefore(IsoChronology. INSTANCE.date(1989, 1, 1));
Set<String> s1 = roster.stream()
. filter(p)
Which code fragment on line 1 makes the s1 set contain the names of all employees born before January 1, 1989?
Options
- A.collect(Collectors.partitioningBy(y)) .get(true) .stream() .map(Employee::getName)
- B.collect(Collectors.toCollection(TreeSet::new));
- C.collect(Collectors.partitioningBy(y)) .get(false) .map(Employee::getName) .collect(Collectors.toSet());
- D.collect(Collectors.partitioningBy(y, Collectors.mapping( Employee::getName, Collectors.toSet()))).
Unlock 1Z0-819 to see the answer
You've previewed enough free 1Z0-819 questions. Unlock 1Z0-819 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.