interface comparator

In collection frameworks a interface called Comparator that contain two method int compare(Object) and equals(Object).I implement this interface into a class and override only compare() but not equals(),it compile and run sucessfully.HOW?
[273 byte] By [hai_karuppaIyana] at [2007-11-26 20:05:06]
# 1

because java.lang.Object already provides an implementation of equals() for you. if you read the docs for Comparator, you'll see the intent of the equals method here is slightly different

there was a lengthy discussion on the boards not too long ago about why the method is re-declared on this interface. a search for Comparator equals might find it for you

I'm feeling generous today, and [url=http://forum.java.sun.com/thread.jspa?threadID=5127850&start=0&tstart=0]found it for you[/url]

Message was edited by:

georgemc

georgemca at 2007-7-9 23:05:56 > top of Java-index,Core,Core APIs...
# 2
Object class having the equals() methodif ur not overided it is override automatically
sivaraju@javaa at 2007-7-9 23:05:56 > top of Java-index,Core,Core APIs...