java - Why hashcode does not generate unique hashcode? -
We know that the default execution of hashcode () returns an integer after changing the internal address of an object in an integer. So the internal memory of each object is different, then why hasosh () does not generate the hash code unique
My question is why ishosh () [This integer which represents the address represents an object] does not generate unique code, if we do not override the hash code () and equal is?
Because it can not do.
Since there are only 2 ^ 32 different inks and any VM instance can have 2 ^ 32 live objects, therefore it is impossible to guarantee a unique hash code for each object.
Even if the default hash code can be based on the internal address of the object, then it is not the same as the internal address.
Comments
Post a Comment