question: public Table sortOn ( String ... columnNames ) { Sort key = null ; Order order ; List < String > names = new ArrayList < > ( ) ; for ( String name : columnNames ( ) ) { names . add ( name . toUpperCase ( ) ) ; } for ( String columnName : columnNames ) { if ( names . contains ( columnName . toUpperCase ( ) ) ) { order = Order . ASCEND ; } else { String prefix = columnName . substring ( 0 , 1 ) ; columnName = columnName . substring ( 1 , columnName . length ( ) ) ; switch ( prefix ) { case "+" : order = Order . ASCEND ; break ; case "-" : order = Order . DESCEND ; break ; default : throw new IllegalStateException ( "Column prefix: " + prefix + " is unknown." ) ; } } if ( key == null ) { key = first ( columnName , order ) ; } else { key . next ( columnName , order ) ; } } return sortOn ( key ) ; }
target:  Returns a copy of this table sorted on the given column names, applied in order, <p> if column name starts with - then sort that column descending otherwise sort ascending