exam questions

Exam 1z0-819 All Questions

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

Exam 1z0-819 topic 1 question 181 discussion

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

Given:



and the code fragment:



You want to examine the items list if it contains an item for which the variable count is below zero.

Which code fragment at line 1 will accomplish this?

  • A. if(items.stream().allMatch(i -> i.count < 0)) {
  • B. if(items.stream().anyMatch(i -> i.count < 0)) {
  • C. if(items.stream().filter(i -> i.count < 0).findAny()) {
  • D. if(items.stream().filter(i -> i.count < 0).findFirst()) {
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
3 months ago
answer: D Optional<T> findAny() Optional<T> findFirst() boolean AllMatch​(Predicate<? super T> predicate) boolean anyMatch​(Predicate<? super T> predicate) answer: anyMatch​
upvoted 1 times
...
d7bb0b2
1 year ago
Selected Answer: B
B is correct: allmatch check for all element match with the condition and is shortcircuit. C and D retrive an object no a boolean value so if not compile.
upvoted 1 times
...
d7bb0b2
1 year ago
B is correct: allmatch check for all element match with the condition and is shortcircuit. C and D retrive an element no a boolean value so if not compile.
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