exam questions

Exam 1z0-819 All Questions

View all questions & answers for the 1z0-819 exam

Exam 1z0-819 topic 1 question 30 discussion

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

Given a Member class with fields for name and yearsMembership, including getters and setters and a print method, and a list of clubMembers members:

Which two Stream methods can be changed to use method references? (Choose two.)

  • A. .filter(Integer::equals(0))
  • B. .map(testName::compareToIgnoreCase)
  • C. .filter(Member::getYearsMembership() >= testMembershipLength)
  • D. .peek(Member::print)
Show Suggested Answer Hide Answer
Suggested Answer: BD 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
ASPushkin
5 months ago
Selected Answer: BD
answer: BD A. Failed The Basic format of a method reference is broadly <scope>::<method-name> without parameter names. C Failed The Basic format of a method reference is broadly <scope>::<method-name> without parameter names. But here there is an boolean expression at the right hand. B correct Reference to an instance method of a particular object containingObject::instanceMethodName D. correct Reference to an instance method of an arbitrary object of a particular type ContainingType::methodName
upvoted 1 times
...
rami_mlaiel
9 months, 3 weeks ago
B & D are correct. A : .filter(Integer::equals(0)); You cannot pass parameter when calling through reference C: .filter(Member::getYearsMembership() >= testMembershipLength); You cannot call method reference with '()'
upvoted 1 times
...
d7bb0b2
1 year ago
Selected Answer: BD
b and D are correct, other options are bad sintax
upvoted 1 times
...
[Removed]
1 year, 5 months ago
BD is correct. As A & C are just bad syntax.
upvoted 2 times
...
Mukes877
1 year, 8 months ago
Selected Answer: BD
B and D are correct because method reference is used only for reference method and constructor not for performing comparison
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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago