I am trying to understand exercise 5.2 of the Collections lecture named 
Sort a list using Comparator
In the MyComparators class, don't understand the first line of the method 
stringComparator(), it has a return statement at the first line, not sure 
how that works or the purpose it serves, there is also another return 
statement at the bottom of the method.

I also notice there is a compare method which never gets used when the 
class is called from the main class, what is the intent of that method,? if 
any.

public class MyComparators {
    
    // String Comparator object
    public static Comparator stringComparator() {
        
        return new Comparator() {
            
            public int compare(Object o1, Object o2) {




Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"JPassion.com: Java Programming" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/jpassion_java.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to