Oracle
1Z0-819 · Question #192
1Z0-819 Question #192: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-819 to reveal the answer and full explanation for question #192. The question stem and answer options stay visible for context.
Question
Given:
List<Integer> numbers = List.of(5, 3, 0, 8, 1, 9, 5, 7, 6, 4); int sum = numbers.stream().reduce(0, (n, m) -> n + m); // line 1 You want to make the reduction operation parallelized. Which two modifications should you make?Options
- AReplace line 1 with int sum = numbers. stream (). Interate (). (a -> a+1. Reduce (0, (n,m) -> n+m);
- BReplace line 1with int sum = numbers. ParallelStream (). Reduce (0, (n,m) -> n+m);
- CReplace line 1with int sum = numbers. stream (). mapToInt (a -> a.Reduce (0, (n,m) -> n+m);
- DReplace line 1with int sum = number. stream (). flatMap (a -> a).reduce (0, (n,m) -> n+m);
- EReplace line 1with int sum = number.stream. parallel (). Reduce (0, (n,m) -> n+m);
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.