public < E extends Comparable < E > > boolean sort ( List < E > input ) { if ( input == null ) { return false ; } try { Collections . sort ( input ) ; return true ; } catch ( UnsupportedOperationException ex ) { return false ; } }
Sort the elements within a list according to their natural order . The input list is modified in place so this operation will succeed only if the list is modifiable .