1.

What is the premise of equality for IdentityHashMap?(a) Reference equality(b) Name equality(c) Hashcode equality(d) Length equalityThe question was posed to me in an online interview.My question comes from Data Structures-HashMap in portion java.util – The Collections Framework of Java

Answer»

Right option is (a) Reference equality

The explanation is: IdentityHashMap is RARELY used as it violates the BASIC CONTRACT of implementing equals() and HASHCODE() METHOD.



Discussion

No Comment Found

Related InterviewSolutions