question: @ SuppressWarnings ( "unchecked" ) public static < T > void sort ( List < T > list , Comparator < ? super T > comparator ) { T [ ] array = list . toArray ( ( T [ ] ) new Object [ list . size ( ) ] ) ; Arrays . sort ( array , comparator ) ; int i = 0 ; ListIterator < T > it = list . listIterator ( ) ; while ( it . hasNext ( ) ) { it . next ( ) ; it . set ( array [ i ++ ] ) ; } }
target:  Sorts the specified list using the specified comparator. The algorithm is stable which means equal elements don't get reordered.