On Wednesday 19 November 2003 11:38, Dalibor Topic wrote: > Jeroen Frijters wrote: > > Dalibor Topic wrote: [...] > >>If two objects are not equal, they should have different hashCodes. > > > > No this isn't true, however, if two objects are equal, they must have > > identical hashCodes. It would be nice if unequal objects had different > > hashCodes, but this is not a requirement. > > Note that I used *should* in my sentence instead of *must*, and reparse > what I said ;)
In general it's impossible to ensure that non-equal objects have different hashcodes - just think for a moment about java.lang.Long. So IMHO even "should" is going too far ... -- Chris Gray /k/ Embedded Java Solutions Embedded & Mobile Java, OSGi http://www.kiffer.be/k/ [EMAIL PROTECTED] +32 477 599 703 _______________________________________________ Classpath mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/classpath

