Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam 1z0-819 topic 1 question 129 discussion

Actual exam question from Oracle's 1z0-819
Question #: 129
Topic #: 1
[All 1z0-819 Questions]

Given:



and



Which code fragment, when inserted on line 1, gives the number of employees who were born after January 1, 1989 and have a salary greater than 25?

  • A.
  • B.
  • C.
  • D.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
ASPushkin
2 weeks, 4 days ago
Selected Answer: B
answer : B CD will work as well if stream() is inserted in like: .get(true) .stream() .count(); --------------- Predicate < Employee > p = e -> e.getSalary() > 25; LocalDate d = IsoChronology.INSTANCE.date(1989, 1, 1); Predicate < Employee > p1 = e -> e.getBirthday().isAfter(d); Stream < Employee > s = roster.stream(); Map < Boolean, List < Employee >> youngerThan = s.filter(p).collect(Collectors.partitioningBy(e -> e.getBirthday().isAfter(d))); long youngAndRich = youngerThan.get(true).stream().count();
upvoted 1 times
...
d7bb0b2
4 months, 1 week ago
Selected Answer: B
B IS CORRECT
upvoted 1 times
d7bb0b2
4 months, 1 week ago
C is correct if the las operation has stream(), because when get(true) is executed , List is returned so list no containt count() method
upvoted 1 times
...
...
d7bb0b2
5 months, 1 week ago
B is correct, Stream has count method d Collectors.partitioningBy(predicated) generate a map with two keys true, and false, and values has the list of the predicated definied. but List hasn't count method, if used a size this is true
upvoted 1 times
...
dilleman
7 months, 3 weeks ago
Selected Answer: B
B is correct. Incorrect -> A: e is not defined. Incorrect -> C and D. get(true) returns a stream so it would work if you add .get(true).stream().count()
upvoted 1 times
dilleman
7 months, 3 weeks ago
get(true) returns a list i mean.
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...