code: public OptionalLong indexOf(Predicate<? super T> predicate) {
          return collect(new CancellableCollectorImpl<>(() -> new long[]{-1}, (acc, t) -> {
              if (acc[0] < 0) {
                  if (predicate.test(t)) {
                      acc[0] = -acc[0] - 1;
                  } else {
                      acc[0]--;
                  }
              }
          }, (acc1, acc2) -> {
              if (acc1[0] < 0) {
                  if (acc2[0] < 0) {
                      acc1[0] = acc1[0] + acc2[0] + 1;
                  } else {
                      acc1[0] = acc2[0] - acc1[0] - 1;
                  }
              }
              return acc1;
          }, acc -> acc[0] < 0 ? OptionalLong.empty() : OptionalLong.of(acc[0]), acc -> acc[0] >= 0, NO_CHARACTERISTICS));
      }
docs: Returns an {@link OptionalLong} describing the zero-based index of the
  first element of this stream, which matches given predicate, or an empty
  {@code OptionalLong} if there's no matching element.
  
  <p>
  This is a short-circuiting terminal operation.
  
  @param predicate a <a
  href="package-summary.html#NonInterference">non-interfering </a>,
  <a href="package-summary.html#Statelessness">stateless</a>
  predicate which returned value should match
  @return an {@code OptionalLong} describing the index of the first
  matching element of this stream, or an empty {@code OptionalLong}
  if there's no matching element.
  @see #findFirst(Predicate)
  @see #indexOf(Object)
  @since 0.4.0