DataTable extends AbstractDataSource implements MutableDataSource { @SuppressWarnings("unchecked") public <T> Comparable<T> set(int col, int row, Comparable<T> value) { Comparable<T> old; DataChangeEvent event = null; synchronized (this) { old = (Comparable<T>) get(col, row); if (old == null || !old.equals(value)) { Record record = rows.get(row); ArrayList<Comparable<?>> values = new ArrayList<>(record.size()); for (Comparable<?> element : record) { values.add(element); } values.set(col, value); Record updatedRecord = new Record(values); rows.set(row, updatedRecord); event = new DataChangeEvent(this, col, row, old, value); } } if (event != null) { notifyDataUpdated(event); } return old; } DataTable();  DataTable(Class<? extends Comparable<?>>... types); @SuppressWarnings("unchecked")  DataTable(int cols, Class<? extends Comparable<?>> type);  DataTable(DataSource source);  DataTable(Column... columns); int add(Comparable<?>... values); int add(List<? extends Comparable<?>> values); int add(Row row); void add(Record row); void remove(int row); void removeLast(); void clear(); Comparable<?> get(int col, int row); @SuppressWarnings("unchecked") Comparable<T> set(int col, int row, Comparable<T> value); int getRowCount(); void sort(final DataComparator... comparators); @Override void setName(String name);  }
@Test public void testSet() { int sizeBefore = table.getRowCount(); table.set(1, 2, -1); assertEquals(sizeBefore, table.getRowCount()); assertEquals(-1, table.get(1, 2)); try { table.set(2, 0, 1); fail("Expected IndexOutOfBoundsException exception."); } catch (IndexOutOfBoundsException e) { } }