### Question:
ValuesArray2D extends Array2D<Number> { @Override public Number get(int... coords) { if (coords.length != 2) { throw new IllegalArgumentException("Wrong number of co-ordinates (" + coords.length + ") for this Array (needs 2)"); } return data[coords[Y_IND]][coords[X_IND]]; } ValuesArray2D(int ySize, int xSize); @Override Number get(int... coords); @Override void set(Number value, int... coords);  }### Answer:
@Test public void testIterator() { List<Number> expected = new ArrayList<Number>(); for (int i = 0; i < YSIZE; i++) { for (int j = 0; j < XSIZE; j++) { expected.add(1 * i + j); } } Iterator<Number> iterator = data.iterator(); int index = 0; while (iterator.hasNext() && index < data.size()) { assertEquals(expected.get(index), iterator.next()); index++; } }