This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hi all What is the use of hashcode() function? Is it related to hashtable class ? please help
Layne Lund
Ranch Hand
Joined: Dec 06, 2001
Posts: 3061
posted
0
I am not completely sure, but I think you are on the right track. AFAIK, the HashTable and related classes from the Container API use the hashcode() function when it stores an object.
A hashcode is usually used as an efficient way of searching for stored objects. Say you have a list of 1000 names, it would take a reasonable amount of time to search for the name "Jeremy Thornton" in the list. If however you stored the names according to their hashed value (which is what the HashX type containers do) you just search for the hash of "Jeremy Thornton" - an integer - instead. As integer processing is much faster than string processing the search is much quicker. Hoper this helps, Jeremy.
Shyam Purkayastha
Ranch Hand
Joined: Jan 15, 2001
Posts: 57
posted
0
thanks a lot jeremy
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.