File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes what is contract between equal and hash code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "what is contract between equal and hash code" Watch "what is contract between equal and hash code" New topic
Author

what is contract between equal and hash code

jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
I read in article that if any one of the hashCode() and equals() methods override then other should be overridden. If not it is violation the contract.I cant understand what is contract between equal and hash code.Any direct me in right way
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
That article was correct. The details are all in the Object class.
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3169
    
  10
Take a look at the descriptions of the hashCode and equals method in the Javadoc for the Object class


Joanne
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what is contract between equal and hash code
 
Similar Threads
Doubt regarding hashCode() contract
When to override the equals method
SCJP 1.5 Objective 6.2, hashCode() and equals()
difference between hashCode and equals
HashMap,LinkedHashmap & HashSet and LinkedHAshSet PRoblem