DataTable extends AbstractDataSource implements MutableDataSource { public void sort(final DataComparator... comparators) { synchronized (rows) { RecordComparator comparator = new RecordComparator(comparators); Collections.sort(rows, comparator); } } 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 testSort() { DataTable table = new DataTable(Integer.class, Integer.class, Integer.class); int[] original = { 9, 1, 3, 4, 4, 2, 4, 2, 1, 8, 1, 9, 8, 1, 7, 6, 2, 4, 4, 6, 5, 3, 3, 5 }; int i = 0; while (i < original.length) { table.add(original[i++], original[i++], original[i++]); } table.sort(new Ascending(1), new Descending(0), new Ascending(2)); int[] expected = { 9, 1, 3, 8, 1, 7, 8, 1, 9, 6, 2, 4, 4, 2, 1, 3, 3, 5, 4, 4, 2, 4, 6, 5 }; i = 0; while (i < expected.length) { assertEquals(expected[i], table.get(i%3, i/3)); i++; } }