code: public static IntConsumer intConsumer(CheckedIntConsumer consumer, Consumer<Throwable> handler) {
          return i -> {
              try {
                  consumer.accept(i);
              }
              catch (Throwable e) {
                  handler.accept(e);
  
                  throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
              }
          };
      }
docs: Wrap a {@link CheckedIntConsumer} in a {@link IntConsumer} with a custom handler for checked exceptions.
  <p>
  Example:
  <code><pre>
  Arrays.stream(new int[] { 1, 2 }).forEach(Unchecked.intConsumer(
  i -> {
  if (i &lt; 0)
  throw new Exception("Only positive numbers allowed");
  },
  e -> {
  throw new IllegalStateException(e);
  }
  ));
  </pre></code>