/** * Takes an Iterable of Iterables (e.g. a list of lists), of T and flattens * it down to a Collection of T. */ public static >, Store extends Collection> Store flatten(Source source, Store store) { for (Iterable subSource : source) { for (T t : subSource) { store.add(t); } } return store; }