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”));
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.
yuu_oppai
2 months, 3 weeks ago