• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hashcode & equals

 
siva mail
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers ,

Can you please tell me how Hashcode & Equals are related to each other. I didnt get how equals & Hashcode methods are called when you are calling get method on HashMap. In what are all scenarios these Hashcode & Equals are called internally.

your help is Appreciated

Thanks in advance
Siva
 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the API for Object. The contract for both methods, and the relation between them, is quite clearly documented.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic