### Question:
DefaultKeyedValues2D implements KeyedValues2D, PublicCloneable,
        Cloneable, Serializable { @Override public boolean equals(Object o) { if (o == null) { return false; } if (o == this) { return true; } if (!(o instanceof KeyedValues2D)) { return false; } KeyedValues2D kv2D = (KeyedValues2D) o; if (!getRowKeys().equals(kv2D.getRowKeys())) { return false; } if (!getColumnKeys().equals(kv2D.getColumnKeys())) { return false; } int rowCount = getRowCount(); if (rowCount != kv2D.getRowCount()) { return false; } int colCount = getColumnCount(); if (colCount != kv2D.getColumnCount()) { return false; } for (int r = 0; r < rowCount; r++) { for (int c = 0; c < colCount; c++) { Number v1 = getValue(r, c); Number v2 = kv2D.getValue(r, c); if (v1 == null) { if (v2 != null) { return false; } } else { if (!v1.equals(v2)) { return false; } } } } return true; } DefaultKeyedValues2D();  DefaultKeyedValues2D(boolean sortRowKeys); @Override int getRowCount(); @Override int getColumnCount(); @Override Number getValue(int row, int column); @Override Comparable getRowKey(int row); @Override int getRowIndex(Comparable key); @Override List<Comparable> getRowKeys(); @Override Comparable getColumnKey(int column); @Override int getColumnIndex(Comparable key); @Override List<Comparable> getColumnKeys(); @Override Number getValue(Comparable rowKey, Comparable columnKey); void addValue(Number value, Comparable rowKey,
                         Comparable columnKey); void setValue(Number value, Comparable rowKey,
                         Comparable columnKey); void removeValue(Comparable rowKey, Comparable columnKey); void removeRow(int rowIndex); void removeRow(Comparable rowKey); void removeColumn(int columnIndex); void removeColumn(Comparable columnKey); void clear(); @Override boolean equals(Object o); @Override int hashCode(); @Override Object clone();  }### Answer:
@Test public void testEquals() { DefaultKeyedValues2D d1 = new DefaultKeyedValues2D(); DefaultKeyedValues2D d2 = new DefaultKeyedValues2D(); assertEquals(d1, d2); assertEquals(d2, d1); d1.addValue(1.0, 2.0, "S1"); assertFalse(d1.equals(d2)); d2.addValue(1.0, 2.0, "S1"); assertEquals(d1, d2); }