Exam 1z0-809 All QuestionsBrowse all questions from this exam
Question 203

Given the code fragment:

What is the result?

    Correct Answer: C

    E

Discussion
Svetleto13Option: C

C,tested

jduarteOption: C

Answer C. Tested

duydnOption: C

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); }

balikeOption: C

C,tested

WilsonKKerllOption: C

C, Tested.

LocalHero

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

steefaandOption: C

C is correct after fixing typos.