code: @NotNull
      public OptionalDouble reduce(@NotNull DoubleBinaryOperator accumulator) {
          boolean foundAny = false;
          double result = 0;
          while (iterator.hasNext()) {
              final double value = iterator.nextDouble();
              if (!foundAny) {
                  foundAny = true;
                  result = value;
              } else {
                  result = accumulator.applyAsDouble(result, value);
              }
          }
          return foundAny ? OptionalDouble.of(result) : OptionalDouble.empty();
      }
docs: Performs a reduction on the elements of this stream, using an
  associative accumulation function, and returns an {@code OptionalDouble}
  describing the reduced value, if any.
  
  <p>The {@code accumulator} function must be an associative function.
  
  <p>This is a terminal operation.
  
  @param accumulator  the accumulation function
  @return the result of the reduction
  @see #reduce(com.annimon.stream.function.DoubleBinaryOperator)