/** * Converts checked exceptions to unchecked based on the {@code BiFunction} interface. * <p> * This wraps the specified function returning an instance that handles checked exceptions. * If a checked exception is thrown it is converted to an {@link UncheckedIOException} * or {@link RuntimeException} as appropriate. * * @param <T> the first input type of the function * @param <U> the second input type of the function * @param <R> the return type of the function * @param function the function to be decorated * @return the function instance that handles checked exceptions */ public static <T, U, R> BiFunction<T, U, R> biFunction(CheckedBiFunction<T, U, R> function) { return (t, u) -> { try { return function.apply(t, u); } catch (Throwable ex) { throw propagate(ex); } }; }