public static <T> Predicate<T> predicate(CheckedPredicate<T> function, Consumer<Throwable> handler) {
        return t -> {
            try {
                return function.test(t);
            }
            catch (Throwable e) {
                handler.accept(e);

                throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
            }
        };
    }
Wrap a {@link CheckedPredicate} in a {@link Predicate} with a custom handler for checked exceptions.
<p>
Example:
<pre><code>
Stream.of("a", "b", "c").filter(Unchecked.predicate(
    s -> {
        if (s.length() > 10)
            throw new Exception("Only short strings allowed");

        return true;
    },
    e -> {
        throw new IllegalStateException(e);
    }
));
</code></pre>
jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java