File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Java SE 8 for the Really Impatient
this week in the
Programmer Certification (SCJP/OCPJP)
interdependence of equals() and hashCode()
Joined: Aug 05, 2002
Jul 21, 2003 08:58:00
if x.equals(y) is true, then x.hashCode() == y.hashCode()must be true.
If the above statement is true, why is that contract of equals method does not mention this requirement?
Joined: Apr 24, 2003
Jul 21, 2003 09:34:00
It does not get mentioned in equals() contract becuase it belongs to hashCode() contract.
I agree. Here's the link:
subject: interdependence of equals() and hashCode()
Mock doubt, a Q about equals contract
Related to String
how does equals() work with lists as objects?
difference between !=(Not equal) and ^(XOR)
hashCode(), compareTo() and equals()
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014