DataTable extends AbstractDataSource implements MutableDataSource { public int getRowCount() { return rows.size(); } 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 @SuppressWarnings("unchecked") public void testCreate() { DataTable table1 = new DataTable(Integer.class, Double.class, Long.class, Float.class); assertEquals(4, table1.getColumnCount()); assertEquals(0, table1.getRowCount()); Class<? extends Comparable<?>>[] types1 = table1.getColumnTypes(); assertEquals(Integer.class, types1[0]); assertEquals(Double.class, types1[1]); assertEquals(Long.class, types1[2]); assertEquals(Float.class, types1[3]); DataTable table2 = new DataTable(3, Double.class); assertEquals(3, table2.getColumnCount()); assertEquals(0, table1.getRowCount()); Class<? extends Comparable<?>>[] types2 = table2.getColumnTypes(); for (Class<? extends Comparable<?>> aTypes2 : types2) { assertEquals(Double.class, aTypes2); } DataTable table3 = new DataTable(table1); assertEquals(table1.getColumnCount(), table3.getColumnCount()); assertEquals(table1.getRowCount(), table3.getRowCount()); Class<? extends Comparable<?>>[] types3 = table1.getColumnTypes(); for (int i = 0; i < types3.length; i++) { assertEquals(types1[i], types3[i]); } }