/** * Convert a {@link BiConsumerWithException} into a {@link BiConsumer}. * * @param biConsumerWithException BiConsumer with exception to convert into a {@link BiConsumer}. * @param <A> first input type * @param <B> second input type * @return {@link BiConsumer} which rethrows all checked exceptions as unchecked. */ static <A, B> BiConsumer<A, B> unchecked(BiConsumerWithException<A, B, ?> biConsumerWithException) { return (A a, B b) -> { try { biConsumerWithException.accept(a, b); } catch (Throwable t) { ExceptionUtils.rethrow(t); } }; } }
/** * Convert a {@link BiConsumerWithException} into a {@link BiConsumer}. * * @param biConsumerWithException BiConsumer with exception to convert into a {@link BiConsumer}. * @param <A> first input type * @param <B> second input type * @return {@link BiConsumer} which rethrows all checked exceptions as unchecked. */ static <A, B> BiConsumer<A, B> unchecked(BiConsumerWithException<A, B, ?> biConsumerWithException) { return (A a, B b) -> { try { biConsumerWithException.accept(a, b); } catch (Throwable t) { ExceptionUtils.rethrow(t); } }; } }