fork download
  1. import java.util.List;
  2. import java.util.stream.Collectors;
  3.  
  4. class Ideone {
  5. public static void main(String[] args) {
  6. final List<List<String>> listOfLists = List.of(List.of("A", "B"), List.of("C", "D"));
  7. final List<String> list = listOfLists.stream()
  8. .flatMap(List::stream)
  9. .collect(Collectors.toList());
  10. System.out.println(list);
  11. }
  12. }
Success #stdin #stdout 0.14s 52284KB
stdin
Standard input is empty
stdout
[A, B, C, D]