java - Object's **hashCode** function - how does jdk uses it? -


i know whenever override equals method should override hashcode method .

but im not sure is, how jdk uses it?

for example hashset/hashmap set/map implementation using hash table, correct table use object's hash_code key hash_function?

so correct table use object's hash_code key hash_function?

almost. hashcode() hash function. hashmap whenever tries find key or put key, calls key hashcode() method , uses (with bit mask)to find proper element in hash table.

also note it's not used directly jvm justby classes.


Comments

Popular posts from this blog

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

wordpress - (T_ENDFOREACH) php error -

Using django-mptt to get only the categories that have items -