@Test public void testRemoveValue() { DefaultKeyedValues2D d = new DefaultKeyedValues2D(); d.removeValue("R1", "C1"); d.addValue(1.0, "R1", "C1"); d.removeValue("R1", "C1"); assertEquals(0, d.getRowCount()); assertEquals(0, d.getColumnCount()); d.addValue(1.0, "R1", "C1"); d.addValue(2.0, "R2", "C1"); d.removeValue("R1", "C1"); assertEquals(2.0, d.getValue(0, 0)); }
public void removeValue(Comparable rowKey, Comparable columnKey) { setValue(null, rowKey, columnKey); boolean allNull = true; int rowIndex = getRowIndex(rowKey); DefaultKeyedValues row = this.rows.get(rowIndex); for (int item = 0, itemCount = row.getItemCount(); item < itemCount; item++) { if (row.getValue(item) != null) { allNull = false; break; } } if (allNull) { this.rowKeys.remove(rowIndex); this.rows.remove(rowIndex); } allNull = true; for (DefaultKeyedValues rowItem : this.rows) { int columnIndex = rowItem.getIndex(columnKey); if (columnIndex >= 0 && rowItem.getValue(columnIndex) != null) { allNull = false; break; } } if (allNull) { for (DefaultKeyedValues rowItem : this.rows) { int columnIndex = rowItem.getIndex(columnKey); if (columnIndex >= 0) { rowItem.removeValue(columnIndex); } } this.columnKeys.remove(columnKey); } }
DefaultKeyedValues2D implements KeyedValues2D, PublicCloneable,
        Cloneable, Serializable { public void removeValue(Comparable rowKey, Comparable columnKey) { setValue(null, rowKey, columnKey); boolean allNull = true; int rowIndex = getRowIndex(rowKey); DefaultKeyedValues row = this.rows.get(rowIndex); for (int item = 0, itemCount = row.getItemCount(); item < itemCount; item++) { if (row.getValue(item) != null) { allNull = false; break; } } if (allNull) { this.rowKeys.remove(rowIndex); this.rows.remove(rowIndex); } allNull = true; for (DefaultKeyedValues rowItem : this.rows) { int columnIndex = rowItem.getIndex(columnKey); if (columnIndex >= 0 && rowItem.getValue(columnIndex) != null) { allNull = false; break; } } if (allNull) { for (DefaultKeyedValues rowItem : this.rows) { int columnIndex = rowItem.getIndex(columnKey); if (columnIndex >= 0) { rowItem.removeValue(columnIndex); } } this.columnKeys.remove(columnKey); } } }
DefaultKeyedValues2D implements KeyedValues2D, PublicCloneable,
        Cloneable, Serializable { public void removeValue(Comparable rowKey, Comparable columnKey) { setValue(null, rowKey, columnKey); boolean allNull = true; int rowIndex = getRowIndex(rowKey); DefaultKeyedValues row = this.rows.get(rowIndex); for (int item = 0, itemCount = row.getItemCount(); item < itemCount; item++) { if (row.getValue(item) != null) { allNull = false; break; } } if (allNull) { this.rowKeys.remove(rowIndex); this.rows.remove(rowIndex); } allNull = true; for (DefaultKeyedValues rowItem : this.rows) { int columnIndex = rowItem.getIndex(columnKey); if (columnIndex >= 0 && rowItem.getValue(columnIndex) != null) { allNull = false; break; } } if (allNull) { for (DefaultKeyedValues rowItem : this.rows) { int columnIndex = rowItem.getIndex(columnKey); if (columnIndex >= 0) { rowItem.removeValue(columnIndex); } } this.columnKeys.remove(columnKey); } } DefaultKeyedValues2D();  DefaultKeyedValues2D(boolean sortRowKeys); }
DefaultKeyedValues2D implements KeyedValues2D, PublicCloneable,
        Cloneable, Serializable { public void removeValue(Comparable rowKey, Comparable columnKey) { setValue(null, rowKey, columnKey); boolean allNull = true; int rowIndex = getRowIndex(rowKey); DefaultKeyedValues row = this.rows.get(rowIndex); for (int item = 0, itemCount = row.getItemCount(); item < itemCount; item++) { if (row.getValue(item) != null) { allNull = false; break; } } if (allNull) { this.rowKeys.remove(rowIndex); this.rows.remove(rowIndex); } allNull = true; for (DefaultKeyedValues rowItem : this.rows) { int columnIndex = rowItem.getIndex(columnKey); if (columnIndex >= 0 && rowItem.getValue(columnIndex) != null) { allNull = false; break; } } if (allNull) { for (DefaultKeyedValues rowItem : this.rows) { int columnIndex = rowItem.getIndex(columnKey); if (columnIndex >= 0) { rowItem.removeValue(columnIndex); } } this.columnKeys.remove(columnKey); } } 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(); }
DefaultKeyedValues2D implements KeyedValues2D, PublicCloneable,
        Cloneable, Serializable { public void removeValue(Comparable rowKey, Comparable columnKey) { setValue(null, rowKey, columnKey); boolean allNull = true; int rowIndex = getRowIndex(rowKey); DefaultKeyedValues row = this.rows.get(rowIndex); for (int item = 0, itemCount = row.getItemCount(); item < itemCount; item++) { if (row.getValue(item) != null) { allNull = false; break; } } if (allNull) { this.rowKeys.remove(rowIndex); this.rows.remove(rowIndex); } allNull = true; for (DefaultKeyedValues rowItem : this.rows) { int columnIndex = rowItem.getIndex(columnKey); if (columnIndex >= 0 && rowItem.getValue(columnIndex) != null) { allNull = false; break; } } if (allNull) { for (DefaultKeyedValues rowItem : this.rows) { int columnIndex = rowItem.getIndex(columnKey); if (columnIndex >= 0) { rowItem.removeValue(columnIndex); } } this.columnKeys.remove(columnKey); } } 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();  }