what ios hashcode?

Hashcodes are typically used to increase the performance of large collections of
data. you can think of it as kind of an object ID number, it isn't necessarily unique. 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.

Understanding Hashcodes
Alex- A(1) + L(12) + E(5) + X(24)=42(hash code)
BOB-B(2) + O(15) + B(2) = 19
Dirk-D(4) + I(9) + R(18) + K(11) = 42
Fred-F(6) + R(18) + E(5) + D(4) = 33
You might have noticed a little flaw in our system, though. Two different names(alex,dirk)
might result in the same value.

No comments:

Post a Comment