public static DoubleConsumer doubleConsumer(CheckedDoubleConsumer consumer, Consumer<Throwable> handler) {
        return d -> {
            try {
                consumer.accept(d);
            }
            catch (Throwable e) {
                handler.accept(e);

                throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
            }
        };
    }
Wrap a {@link CheckedDoubleConsumer} in a {@link DoubleConsumer} with a custom handler for checked exceptions.
<p>
Example:
<pre><code>
Arrays.stream(new double[] { 1.0, 2.0 }).forEach(Unchecked.doubleConsumer(
    d -> {
        if (d &lt; 0.0)
            throw new Exception("Only positive numbers allowed");
    },
    e -> {
        throw new IllegalStateException(e);
    }
));
</code></pre>
jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java