Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is contract between equal and hash code

 
jacob deiter
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 48968
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That article was correct. The details are all in the Object class.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the descriptions of the hashCode and equals method in the Javadoc for the Object class
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic