Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hashcode & equals

 
siva mail
Greenhorn
Posts: 19
  • 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: 20606
60
Chrome Eclipse IDE Java Windows
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic