A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
Arduino in Action
this week in the
General Computing
forum!
A special promo:
Enter your blog post or vote on a blogger to be featured in an upcoming Journal
JavaRanch
»
Java Forums
»
Certification
»
Programmer Certification (SCJP/OCPJP)
Author
interdependence of equals() and hashCode()
Barkat Mardhani
Ranch Hand
Joined: Aug 05, 2002
Posts: 787
posted
Jul 21, 2003 08:58:00
0
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?
Thanks
Barkat
Alex Radomski
Greenhorn
Joined: Apr 24, 2003
Posts: 24
posted
Jul 21, 2003 09:34:00
0
Hi Barkat,
It does not get mentioned in equals() contract becuase it belongs to hashCode() contract.
Alex
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: interdependence of equals() and hashCode()
Similar Threads
hashCode(), compareTo() and equals()
difference between !=(Not equal) and ^(XOR)
how does equals() work with lists as objects?
Related to String
Mock doubt, a Q about equals contract
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter