### Question:
DenseMatrix extends Matrix { @Override protected final void forEach(final ElementVisitorFunction func) { for (int i = 0; i < this.getRowCount(); ++i) { for (int j = 0; j < this.getColumnCount(); ++j) { final SetWrapper setWrapper = new SetWrapper(i, j); func.visit(i, j, this.getAtUnchecked(i, j), setWrapper); } } } DenseMatrix(final int rows, final int cols);  DenseMatrix(final int rows, final int cols, final double[] values); double[] getRaw(); @Override MatrixNonZeroElementRowIterator getNonZeroElementRowIterator(final int row); @Override String toString();  }### Answer:
@Test public void forEachReturnsAllElements() { final Matrix matrix = this.createMatrix(3, 2, new double[] {2, 0, 0, 1, -5, 8}); final List<Double> values = new ArrayList<>(); matrix.forEach((row, col, value) -> values.add(value)); MatcherAssert.assertThat(values, IsEquivalent.equivalentTo(2.0, 0.0, 0.0, 1.0, -5.0, 8.0)); }