code: public static <T> Stream<List<T>> aggregateOnListCondition(Stream<T> source, BiPredicate<List<T>, T> predicate) {
          return StreamSupport.stream(new AggregatingSpliterator<>(source.spliterator(), predicate), false)
                  .onClose(source::close);
      }
docs: Aggregates items from source stream. Similar to @aggregate, but uses different predicate, evaluated on all items aggregated so far
  and next item from source stream.
  @param source - source stream
  @param predicate - predicate specifying boundary between groups of items
  @param <T> The type over which the stream streams.
  @return Stream of List&lt;T&gt; aggregated according to predicate