There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
vijay sachin wrote:... What is Hashcode? (I searched in internet I found: Hashcode is a unique Id given to the Object...
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
marc weber wrote:
vijay sachin wrote:... What is Hashcode? (I searched in internet I found: Hashcode is a unique Id given to the Object...
The internet is wrong.Hashcodes are not necessarily unique.
The API documentation for Object's hashCode() method should answer most of your questions.
kumarjit banerjee wrote:... The hashCode() method is defined to provide an unique value to an object...
As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects.
A hash function may map two or more keys to the same hash value. In many applications, it is desirable to minimize the occurrence of such collisions, which means that the hash function must map the keys to the hash values as evenly as possible.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors