streamでリストの結合がしたい


[[a, a, a], [b, b, b], [c, c, c]]  
を  
[a,a,a,b,b,b,c,c,c]  
こうしたいのですが、streamで一発で出来る方法ってありますか？

[code]

    //普通にループするとこんな感じです。
    List innerA = Arrays.asList("a","a","a");
    List innerB = Arrays.asList("b","b","b");
    List innerC = Arrays.asList("c","c","c");
    List<List> outer = Arrays.asList(innerA,innerB,innerC);
    System.out.println(outer);
    //[[a, a, a], [b, b, b], [c, c, c]]
    
    List innerABC = new ArrayList<>();
    for(List inner : outer){
        innerABC.addAll(inner);
    }
    System.out.println(innerABC);
    //[a,a,a,b,b,b,c,c,c]
    
[/code]




[Stream#flatMap(...)](http://docs.oracle.com/javase/jp/8/docs/api/java/util/stream/Stream.html#flatMap-
java.util.function.Function-)が使えるかもしれません。

[code]

    import java.util.*;
    import java.util.stream.*;
    import java.util.function.*;
    
    public class StreamTest {
      public static void main(String... args) {
        List<String> innerA = Arrays.asList("a", "a", "a");
        List<String> innerB = Arrays.asList("b", "b", "b");
        List<String> innerC = Arrays.asList("c", "c", "c");
        List<List<String>> outer = Arrays.asList(innerA, innerB, innerC);
        //List innerABC = new ArrayList<>();
        //for(List inner : outer){
        //    innerABC.addAll(inner);
        //}
        List<String> innerABC = outer.stream()
          .flatMap(lst -> lst.stream())
          .collect(Collectors.toList());
    
        System.out.println(innerABC);
      }
    }
    
[/code]

