public static <T> Collection<T> flatten(Iterable<? extends Iterable<T>> coll) {
        final List<T> result = new ArrayList<>();
        for(Iterable<T> o: coll) {
            for(T el: o) {
                result.add(el);
            }
        }
        return result;
    }
public static < T > Collection < T > flatten ( Iterable < ? extends Iterable < T > > coll ) { final List < T > result = new ArrayList < > ( ) ; for ( Iterable < T > o : coll ) { for ( T el : o ) { result . add ( el ) ; } } return result ; }
Takes a collection of collections and creates a new collection from the elements, leaving out the innermost
level of collection.