Static sort APIs in the 1,arrays class
The sort in Arrays.sort (int[] a) is a quick sort, with a time complexity of O (NLOGN)
Arrays.sort (t[],comparator< super t> C) uses a merge sort, and the merge sort is stable , arranged in natural order when C=null
2,collections static sort api,collections are stable.
Collections.sort (list<t> List), and Collections.sort (list<t> list,comparator<. Super t> C); Using the sort is stable, mainly on the list sort , do not know what sort of method, the source can not see
3,arraylist Sorting API
LIst.sort (comparator< super t> c); Sort list, when c=null, arrange by natural order
sum up a convenient memory:
1, for list sorting, you can use the list's own sort method, or you can use the collections static sorting method, and the collections sorting method is stable
2,arrays Static Sort, one is a fast row, a merge sort (stable)