public static < T extends Comparable < ? super T > > List < T > sorted ( List < T > list ) { List < T > result = new ArrayList <> ( list ) ; Collections . sort ( result ) ; return result ; }
Sorts the given list in ascending natural order . The algorithm is stable which means equal elements don t get reordered .