Java Code Examples for tech.tablesaw.api.Table#sortAscendingOn()

The following examples show how to use tech.tablesaw.api.Table#sortAscendingOn() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TableUtils.java    From Dhalion with MIT License 5 votes vote down vote up
static Table sort(Table table, boolean descending, String[] columns) {
  Table result;
  if (descending) {
    result = table.sortDescendingOn(columns);
  } else {
    result = table.sortAscendingOn(columns);
  }

  return result;
}
 
Example 2
Source File: GettingStarted.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
private void sorting() {
  Table table = Table.create("table");
  try {
    // @@ sort
    Table sorted = table.sortOn("foo", "bar", "bam"); // Sorts Ascending by Default
    sorted = table.sortAscendingOn("bar"); // just like sortOn(), but makes the order explicit.
    sorted = table.sortDescendingOn("foo");

    // sort on foo ascending, then bar descending. Note the minus sign preceding the name of
    // column bar.
    sorted = table.sortOn("foo", "-bar");
    // @@ sort
  } catch (Exception e) {
  }
}
 
Example 3
Source File: GettingStarted.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
private void sorting() {
  Table table = Table.create("table");
  try {
    // @@ sort
    Table sorted = table.sortOn("foo", "bar", "bam"); // Sorts Ascending by Default
    sorted = table.sortAscendingOn("bar"); // just like sortOn(), but makes the order explicit.
    sorted = table.sortDescendingOn("foo");

    // sort on foo ascending, then bar descending. Note the minus sign preceding the name of
    // column bar.
    sorted = table.sortOn("foo", "-bar");
    // @@ sort
  } catch (Exception e) {
  }
}