docs: @SuppressWarnings("unchecked")
      public static <T> ReactiveSeq<T> takeUntil(final Stream<T> stream, final Predicate<? super T> predicate) {
          final Iterator<T> it = stream.iterator();
  
          class LimitUntil implements Iterator<T> {
              T next = (T) NULL;
              boolean test = false;
  
              void test() {
                  if (!test && next == NULL && it.hasNext()) {
                      next = it.next();
  
                      if (test = predicate.test(next)) {
                          next = (T) NULL;
                          close(it); // need to close any open queues
                      }
                  }
              }
  
              @Override
              public boolean hasNext() {
                  test();
                  return next != NULL;
              }
  
              @Override
              public T next() {
                  if (next == NULL)
                      throw new NoSuchElementException();
  
                  try {
                      return next;
                  } finally {
                      next = (T) NULL;
                  }
              }
          }
  
          return ReactiveSeq.fromIterator(new LimitUntil())
                    .onClose(() -> {
                        stream.close();
                    });
      }