/** * Converts checked exceptions to unchecked based on the {@code BiPredicate} interface. * <p> * This wraps the specified predicate 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 type of the predicate * @param <U> the second type of the predicate * @param predicate the predicate to be decorated * @return the predicate instance that handles checked exceptions */ public static <T, U> BiPredicate<T, U> biPredicate(CheckedBiPredicate<T, U> predicate) { return (t, u) -> { try { return predicate.test(t, u); } catch (Throwable ex) { throw propagate(ex); } }; }