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-816 topic 1 question 16 discussion

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

Given:
var fruits = List.of(“apple”, “orange”, “banana”, “lemon”);
You want to examine the first element that contains the character n.
Which statement will accomplish this?

  • A. String result = fruits.stream().filter(f −> f.contains(“n”)).findAny();
  • B. fruits.stream().filter(f −> f.contains(“n”)).forEachOrdered(System.out::print);
  • C. Optional<String> result = fruits.stream().filter(f −> f.contains(“n”)).findFirst ();
  • D. Optional<String> result = fruits.stream().anyMatch(f −> f.contains(“n”));
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
yuu_oppai
2 weeks, 2 days ago
Selected Answer: C
The correct answer is C
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 ...