1z0-809 Exam QuestionsBrowse all questions from this exam

1z0-809 Exam - Question 203


Given the code fragment:

What is the result?

Show Answer
Correct Answer: CE

E

Discussion

7 comments
Sign in to comment
jduarteOption: C
Feb 8, 2021

Answer C. Tested

Svetleto13Option: C
May 14, 2021

C,tested

WilsonKKerllOption: C
Mar 21, 2022

C, Tested.

balikeOption: C
Jul 5, 2022

C,tested

duydnOption: C
Sep 22, 2023

C. code: public static void main (String[] args) throws InterruptedException, ExecutionException { List<String> li = Arrays.asList("pen", "a", "pencil"); Predicate<String> test = s -> { int i = 0; boolean result = s.contains("pen"); System.out.print(i++ + ":"); return result; }; li.stream().filter(test).findFirst().ifPresent(System.out::println); }

steefaandOption: C
Feb 7, 2024

C is correct after fixing typos.

LocalHero
May 11, 2024

list.contains("string") is end first index.