KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
From the book CLRS ("Introduction to Algorithms"), there are several hashing functions, such as mod, multiply, etc. What hashing function does Java use to map the keys to slots? I have seen there is a question here Hashing function used in Java Language . But it doesn't answer the question, and I think the marked answer for that question is wrong. It says that hashCode() let you do your own hashing function for Hashtable, but I think it is wrong. The integer returned by hashCode() is the real key for Hashtble, then Hashtable uses a hashing function to hash the hashCode(). What this answer implies is that Java give you a chance to give Hashtable a hashing function, but no, it is wrong. hashCode() gives the real key, not the hashing function. So what exactly the hashing function does Java use?
Tags (comma-separated)
Save Edits
Cancel