### Question:
DiVector { public void componentwiseTransform(Function<Double, Double> function) { for (int i = 0; i < dimensions; i++) { high[i] = function.apply(high[i]); low[i] = function.apply(low[i]); } } DiVector(int dimensions);  DiVector(DiVector base); static DiVector addToLeft(DiVector left, DiVector right); int getDimensions(); DiVector scale(double z); void renormalize(double targetNorm); void componentwiseTransform(Function<Double, Double> function); double getHighLowSum(int i); double getHighLowSum(); final double[] high; final double[] low; }### Answer:
@Test public void testComponentwiseTransform() { vector.high[0] = 1.1; vector.high[1] = 2.1; vector.high[2] = 3.1; vector.low[0] = 101.1; vector.low[1] = 202.1; vector.low[2] = 303.1; double[] highCopy = Arrays.copyOf(vector.high, dimensions); double[] lowCopy = Arrays.copyOf(vector.low, dimensions); vector.componentwiseTransform(x -> 2 * x - 1); for (int i = 0; i < dimensions; i++) { assertEquals(2 * highCopy[i] - 1, vector.high[i], EPSILON); assertEquals(2 * lowCopy[i] - 1, vector.low[i], EPSILON); } }