Oracle
1Z0-819 · Question #51
1Z0-819 Question #51: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-819 to reveal the answer and full explanation for question #51. The question stem and answer options stay visible for context.
Question
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?
Options
- AString result = fruits.stream().filter(f -> f.contains("n")).findAny();
- Bfruits.stream().filter(f -> f.contains("n")).forEachOrdered(System.out::print);
- COptional<String> result = fruits.stream().filter(f -> f.contains("n")).findFirst();
- DOptional<String> result = fruits.stream().anyMatch(f -> f.contains("n"));
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.