code: public static <T, R> TerminalOp<T, R>
      makeRef(Supplier<R> seedFactory,
              BiConsumer<R, ? super T> accumulator,
              BiConsumer<R,R> reducer) {
          Objects.requireNonNull(seedFactory);
          Objects.requireNonNull(accumulator);
          Objects.requireNonNull(reducer);
          class ReducingSink extends Box<R>
                  implements AccumulatingSink<T, R, ReducingSink> {
              @Override
              public void begin(long size) {
                  state = seedFactory.get();
              }
  
              @Override
              public void accept(T t) {
                  accumulator.accept(state, t);
              }
  
              @Override
              public void combine(ReducingSink other) {
                  reducer.accept(state, other.state);
              }
          }
          return new ReduceOp<T, R, ReducingSink>(StreamShape.REFERENCE) {
              @Override
              public ReducingSink makeSink() {
                  return new ReducingSink();
              }
          };
      }
docs: Constructs a {@code TerminalOp} that implements a mutable reduce on
  reference values.
  
  @param <T> the type of the input elements
  @param <R> the type of the result
  @param seedFactory a factory to produce a new base accumulator
  @param accumulator a function to incorporate an element into an
  accumulator
  @param reducer a function to combine an accumulator into another
  @return a {@code TerminalOp} implementing the reduction