code: public static <T> Comparator<T> comparator(CheckedComparator<T> comparator, Consumer<Throwable> handler) {
          return (t1, t2) -> {
              try {
                  return comparator.compare(t1, t2);
              }
              catch (Throwable e) {
                  handler.accept(e);
  
                  throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
              }
          };
      }
docs: Wrap a {@link CheckedComparator} in a {@link Comparator} with a custom handler for checked exceptions.