This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Collections such as HashMap and HashSet use the hashcode value of an object to determine how the object should be stored in the collection, and the hashcode is used again to help locate the object in the collection
I read something like above in Kathy & Bert(Collections chap) & so interpreted it that way.What does the book means by "hashcode value of an object"?
All it says is that the HashMap class uses the value of an object's hashcode
So what does HashMap class do with the hashcode value?
Is it not used as a key?for faster access..
It uses the hashcode value to figure out which bucket the key/value pair should be in. This is certainly for faster access but saying it's "used as a key" is a very confusing way of saying that, given that there's already something else which is called the "key". That's why I am opposing your attempts to say it's some kind of key.
What the HashMap stores for each of its entries is the key object, the value object, and the hashcode of the key object (adjusted as mentioned earlier by Rob Spoor). But you're trying to refer to the hashcode of the key object as "a key". That's too confusing for me and it's not necessary.