Oracle
1Z0-809 · Question #23
1Z0-809 Question #23: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #23. The question stem and answer options stay visible for context.
Question
Given the code fragment:
List<Integer> list1 = Arrays.asList(10, 20);
List<Integer> list2 = Arrays.asList(15, 30);
//line n1
Which code fragment, when inserted at line n1, prints 10 20 15 30?
Options
- AStream.of(list1, list2) .flatMap(list -> list.stream()) .forEach(s -> System.out.print(s + " "));
- BStream.of(list1, list2) .flatMap(list -> list.intStream()) .forEach(s -> System.out.print(s + " "));
- Clist1.stream() .flatMap(list.stream()).flatMap(e1 -> e1.stream()).forEach(s -> System.out.println(s + " "));
- DStream.of(list1, list2) .flatMapToInt(list -> list.stream()) .forEach(s -> System.out.print(s + " "));
Unlock 1Z0-809 to see the answer
You've previewed enough free 1Z0-809 questions. Unlock 1Z0-809 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.