class SafeFuture extends CompletableFuture<T> {

  public static <U> SafeFuture<Void> allOfFailFast(final SafeFuture<?>... futures) {
    final SafeFuture<Void> complete = new SafeFuture<>();
    Stream.of(futures).forEach(future -> future.finish(() -> {}, complete::completeExceptionally));
    allOf(futures).propagateTo(complete);
    return complete;
  }

}