a-foundation/src/main/java/com/ajjpj/afoundation/collection/ACollectionHelper.java
public static <T, X, E extends Throwable> Collection<X> flatMap(Iterable<T> coll, AFunction1<? super T, ? extends Iterable<X>, E> f) throws E {
        final List<X> result = new ArrayList<>();

        for(T o: coll) {
            for(X el: f.apply(o)) {
                result.add(el);
            }
        }

        return result;
    }
public static <T, X, E extends Throwable> Collection<X> flatMap(Iterable<T> coll, AFunction1<? super T, ? extends Iterable<X>, E> f) throws E {
        final List<X> result = new ArrayList<>();

        for(T o: coll) {
            for(X el: f.apply(o)) {
                result.add(el);
            }
        }

        return result;
    }
Same as <code>map()</code>, except that the transformation function returns collections and all the results are
flattened into a single collection.