Flatten list of lists

Report a typo

Given a list of lists.

List<List<Integer>> list = Arrays.asList(
                Arrays.asList(1, 2, 3),
                Arrays.asList(4, 5, 1),
                Arrays.asList(8, 3, 2)
);

What elements does the numbers list contain?

List<Integer> numbers = list.stream()
        .flatMap(Collection::stream)
        .collect(Collectors.toList());
Select one option from the list
___

Create a free account to access the full topic