Groovy Method to combine list of lists

groovy, list

Solution

Try `flatten`, ie:

list.flatten()

Or, to get the output you want:

list = [[1,2,3], [6], [3,4,5,6]]

assert list.flatten().sort() == [1,2,3,3,4,5,6,6] 

Problem

``` Input >> list = [[1,2,3], [6], [3,4,5,6]] Output >> [1,2,3,3,4,5,6,6] ``` I want to know if there is something more straightforward than this ``` l = [] list.each{ l = l + it } println l ``` like a default groovy closure or method?

Original source