Q:

Can't reference a super method

In my program I am sorting objects by date and however there is also a option for never I would like my list to be ordered like this Never,Never,1/23/12,1/24/12,2/2/16. 
It orders everthing how I like except it puts the never at the end. 
I am ordering by calling Collections.sort(ArrayList); I learned that you can make a custom comparator and I just want to build in the never being first however I cant refrence a super camparator it says Cannot directly invoke the abstract method compare(Object, Object) for the type Comparator<0bject> Do you know How I can get this to work? Is there a better way to sort arrays, or do I just have to completely build it.
class Test2 implements Comparator<Object>
{

@Override
public int compare(Object arg0, Object arg1) {

    // TODO Auto-generated method stub
    int other;
    if (arg0.equals("never")&&!arg1.equals("never"))
    {
        return 1;
    }else if(!arg0.equals("never")&&arg1.equals("never"))
    {

        return -1;
    }else if(arg0.equals("never")&&arg1.equals("never"))
    {

        return 0;
    }else
    {
        other = Comparator.super.compare(arg0,arg1);
    }

    return other;
}

}

A:

I am guessing that your list of 'dates' is actually a list of String objects and currently you are sorting like this:
        List<String> dates = ...;
        Collections.sort(dates);

This works because the String class implements the Comparable interface.  Together 
        java.util.Comparator; and
        java.util.Comparable 

are the two ways to get the Collections.sort to work.  To implement a custom sort you can indeed implement Comparator like you are trying, but the super class of your example is 
        java.lang.Object

Which is one reason you won't be able to compile your code, because there is no compare(Object, Object) method on Object. 
To reference the 'compare' method that is happening by default you could use the String compareTo method directly.  This could look like this:
public class NeverComparator implements Comparator<String> {
    private static String NEVER = "never";

    @Override
    public int compare(String o1, String o2) {
        if (NEVER.equals(o1)) {
            return NEVER.equals(o2) ? 0 : -1;
        }
        if (NEVER.equals(o2)) {
            return 1;
        }
        return o1.compareTo(o2);
    }
}

Having said this however.  If you are trying to sort dates this way you will find that your example only works by fluke and you will have to do some work to actually compare your String dates properly.

