### Question:
VectorN extends AVectorN { public VectorN apply(final Function<Double, Double> function) { for (int i = 0; i < getNumDimensions(); i++) { data[i] = function.apply(get(i)); } return this; } private  VectorN(final int dim); private  VectorN(final double... data); private  VectorN(final IVector vector); static VectorN zero(final int dim); static VectorN empty(); static VectorN from(final double... data); static VectorN copy(final IVector vector); static VectorN fromReal(final RealVector rv); void set(final int i, final double value); VectorN add(final IVector vector); VectorN subtract(final IVector vector); VectorN multiply(final double factor); VectorN apply(final Function<Double, Double> function); @Override double x(); @Override double y(); @Override double get(final int i); @Override int getNumDimensions();  }### Answer:
@Test public void testApply() { assertThat(VectorN.from(1, -2, 3).apply(v -> Math.abs(v * 3))).isEqualTo(VectorN.from(3, 6, 9)); }