docs: public static <T, X extends Throwable> Tuple3<CompletableFuture<Subscription>, Runnable, CompletableFuture<Boolean>> forEachXEvents(
              final Stream<T> stream, final long x, final Consumer<? super T> consumerElement, final Consumer<? super Throwable> consumerError,
              final Runnable onComplete) {
          final CompletableFuture<Boolean> streamCompleted = new CompletableFuture<>();
          final Subscription s = new Subscription() {
              Iterator<T> it = stream.iterator();
              volatile boolean running = true;
  
              @Override
              public void request(final long n) {
  
                  for (int i = 0; i < n && running; i++) {
                      try {
  
                          if (it.hasNext()) {
  
                              consumerElement.accept(it.next());
                          } else {
                              try {
                                  onComplete.run();
                              } finally {
                                  streamCompleted.complete(true);
                                  break;
                              }
                          }
                      } catch (final Throwable t) {
                          consumerError.accept(t);
                      }
                  }
              }
  
              @Override
              public void cancel() {
                  running = false;
  
              }
  
          };
          final CompletableFuture<Subscription> subscription = CompletableFuture.completedFuture(s);
  
          return tuple(subscription, () -> {
              s.request(x);
  
          } , streamCompleted);
  
      }