I can not understand the method implementation and the logic of Collections.sort method. Here is the method implementation i found,
public static
First of all this method return type is void
Because it's in-place implementation. List that passed to method will be sorted
What is
does in the method signature?
>
To compare results that extends Comparable
interface for type T
and it's children.
Object[] a = list.toArray();
Convert list to plain array.
What is the purpose of using Array.sort here?
Sorting of array.
i.set((T)a[j]);
assign to list elements in sorted order from array