public static LongPredicate longPredicate(CheckedLongPredicate function, Consumer<Throwable> handler) {
        return l -> {
            try {
                return function.test(l);
            }
            catch (Throwable e) {
                handler.accept(e);

                throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
            }
        };
    }
Wrap a {@link CheckedLongPredicate} in a {@link LongPredicate} with a custom handler for checked exceptions.
<p>
Example:
<pre><code>
LongStream.of(1L, 2L, 3L).filter(Unchecked.longPredicate(
    l -> {
        if (l &lt; 0L)
            throw new Exception("Only positive numbers allowed");

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