/** * This method allows a BiFunction which throws exceptions to be used in places which expects a BiFunction. * * @param <T> Any Object. * @param <U> Any Object. * @param <R> Any Object. * @param <E> Any Exception. * @param biFunction BiFunction to apply for given arguments. * @return Any Object that result from the bi-function passed. */ public static <T, U, R, E extends Exception> BiFunction<T, U, R> rethrowFunction( BiFunctionWithExceptions<T, U, R, E> biFunction) { return (t,u) -> { try { return biFunction.apply(t,u); } catch (Exception exception) { throwAsUnchecked(exception); return null; } }; }
/** * This method allows a BiFunction which throws exceptions to be used in places which expects a BiFunction. * * @param <T> Any Object. * @param <U> Any Object. * @param <R> Any Object. * @param <E> Any Exception. * @param biFunction BiFunction to apply for given arguments. * @return Any Object that result from the bi-function passed. */ public static <T, U, R, E extends Exception> BiFunction<T, U, R> rethrowFunction( BiFunctionWithExceptions<T, U, R, E> biFunction) { return (t,u) -> { try { return biFunction.apply(t,u); } catch (Exception exception) { throwAsUnchecked(exception); return null; } }; }