• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hashcode()

 
Naveen R R
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Could someone provide me with an example of hashcode()? I need to get the hashcode for each attribute, sum them and rehash them.
And, how does the equals() fit in here?
Thanks,
Naveen
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Every Java class has a hashCode() method - just call it for the String containing your attribute. Look at the source code for java.lang.String for an example.
Bill

------------------
author of:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic