This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Getting MEAN with Mongo, Express, Angular, and Node and have Simon Holmes on-line!
See this thread for details.
The moose likes Servlets and the fly likes hashcode() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "hashcode()" Watch "hashcode()" New topic
Author

hashcode()

Naveen R R
Greenhorn

Joined: May 04, 2001
Posts: 20
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

Joined: Mar 22, 2000
Posts: 12940
    
    5
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:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: hashcode()