public static < T > Collector < Collection < T > , List < T > , List < T > > toFlatList ( ) { return Collector . of ( ArrayList :: new , List :: addAll , ( left , right ) -> { left . addAll ( right ) ; return left ; } ) ; }
Flattening collector . Look at StreamCollectorsTest for example usage