public static <A, B> PartialFunction<A, B> fromFunction(Function<? super A, ? extends B> f) {
        return new PartialFunction<A, B>() {
            @Override
            public boolean isDefinedAt(A x) {
                return true;
            }

            @Override
            public B apply(A a) {
                return f.apply(a);
            }
        };
    }
Work exactly same as scala's PartialFunction.

@param <A> argument type
@param <B> result type
indexr-common/src/main/java/io/indexr/util/function/PartialFunction.java