Collections.sort () za pomocą komparatora? [Zamknięte]

import java.util.*;

public class C_2 {
    public static void main(String args[]) {
        String theStrings[] = { "x", "a", "b", "c", "d" };
        List l = Arrays.asList(theStrings);
        Collections.sort(l);                            // line a
        Collections.sort(l, new ThisIsMyThing());       // line b
        System.out.println(l);
    }
}

class ThisIsMyThing implements Comparator {
    public int compare(Object o1, Object o2) {
        String s1 = (String)o1;
        String s2 = (String)o2;

        return -1 * s1.compareTo(s2);
    }
}

Rozumiem tę klasęC_2 robi sortowanie w oparciu o dwie różne techniki. Jeden to standardCollections.sort(l); A drugi toCollections.sort(l,Comparator<>()); Nie jestem w stanie zrozumieć tej metody sortowania. Czy ktoś może mi to wyjaśnić?

questionAnswers(3)

yourAnswerToTheQuestion