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

        for (T o: coll) {
            if (pf.isDefinedAt (o)) {
                result.add (pf.apply (o));
            }
        }

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

        for (T o: coll) {
            if (pf.isDefinedAt (o)) {
                result.add (pf.apply (o));
            }
        }

        return result;
    }
Applies a transformation function to all elements of a collection, where the partial function is defined for. Creates a new collection
of the transformed elements only. So the number of result elements may be less than the number of elements in the source collection.