code: public <R, A> StreamEx<R> collapse(BiPredicate<? super T, ? super T> collapsible,
              Collector<? super T, A, R> collector) {
          Supplier<A> supplier = collector.supplier();
          BiConsumer<A, ? super T> accumulator = collector.accumulator();
          StreamEx<A> stream = collapseInternal(collapsible, t -> {
              A acc = supplier.get();
              accumulator.accept(acc, t);
              return acc;
          }, (acc, t) -> {
              accumulator.accept(acc, t);
              return acc;
          }, collector.combiner());
          if (collector.characteristics().contains(Collector.Characteristics.IDENTITY_FINISH)) {
              @SuppressWarnings("unchecked")
              StreamEx<R> result = (StreamEx<R>) stream;
              return result;
          }
          return stream.map(collector.finisher());
      }
docs: Perform a partial mutable reduction using the supplied {@link Collector}
  on a series of adjacent elements.
  
  <p>
  This is a <a href="package-summary.html#StreamOps">quasi-intermediate</a>
  partial reduction operation.
  
  @param <R> the type of the elements in the resulting stream
  @param <A> the intermediate accumulation type of the {@code Collector}
  @param collapsible a non-interfering, stateless predicate to apply to the
  pair of adjacent elements of the input stream which returns true
  for elements which should be collected together.
  @param collector a {@code Collector} which is used to combine the
  adjacent elements.
  @return the new stream
  @since 0.3.6