Either in Javadoc as well as the code itself, Comparator interface defines:
int compare(T o1, T o2);
boolean equals(Object obj);
But then this gives no probs compilating:
Comparator a = new Comparator() {
@Override public int compare(Object o1, Object o2) {
//..
}
};
But this does:
Comparator a = new Comparator() {
@Override public boolean equals(Object comparator) {
//..
}
};
How its done for the interface for allowing us not to override method?