code: public static VectorAccumulator asSumFunctionAccumulator(final double neutral,
                                                               final VectorFunction function) {
          return new VectorAccumulator() {
              private final VectorAccumulator sumAccumulator = Vectors.asSumAccumulator(neutral);
  
              @Override
              public void update(int i, double value) {
                  sumAccumulator.update(i, function.evaluate(i, value));
              }
  
              @Override
              public double accumulate() {
                  return sumAccumulator.accumulate();
              }
          };
      }
docs: Creates a sum function accumulator, that calculates the sum of all
  elements in the vector after applying given {@code function} to each of them.
  
  @param neutral the neutral value
  @param function the vector function
  
  @return a sum function accumulator