/** * Convert at {@link BiFunctionWithException} into a {@link BiFunction}. * * @param biFunctionWithException function with exception to convert into a function * @param <A> input type * @param <B> output type * @return {@link BiFunction} which throws all checked exception as an unchecked exception. */ static <A, B, C> BiFunction<A, B, C> unchecked(BiFunctionWithException<A, B, C, ?> biFunctionWithException) { return (A a, B b) -> { try { return biFunctionWithException.apply(a, b); } catch (Throwable t) { ExceptionUtils.rethrow(t); // we need this to appease the compiler :-( return null; } }; } }
/** * Convert at {@link BiFunctionWithException} into a {@link BiFunction}. * * @param biFunctionWithException function with exception to convert into a function * @param <A> input type * @param <B> output type * @return {@link BiFunction} which throws all checked exception as an unchecked exception. */ static <A, B, C> BiFunction<A, B, C> unchecked(BiFunctionWithException<A, B, C, ?> biFunctionWithException) { return (A a, B b) -> { try { return biFunctionWithException.apply(a, b); } catch (Throwable t) { ExceptionUtils.rethrow(t); // we need this to appease the compiler :-( return null; } }; } }