1Z0-829 • Practice Test 29
Free 1Z0-829 practice test — 15 questions with explanations. Set 29. No signup required.
A developer writes the following code to partition a list of integers into even and odd numbers, then print the count of each group:
import java.util.*;
import java.util.stream.*;
public class PartitionExample {
public static void main(String[] args) {List<Integer> numbers = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); Map<Boolean, List<Integer>> partitioned = numbers.stream() .collect(Collectors.partitioningBy(n -> n % 2 == 0)); System.out.println(partitioned.get(true).size() + " " + partitioned.get(false).size());
}
}What is the output?
Choose an answer to begin — your selection is scored in the full session.
15 questions · instant feedback and full explanations after every question.