0

Which data structure that implements a Map interface uses an == operator, rather than the equals method for objects comparison?

18th Feb 2017, 4:53 AM
Kartikeya Bhardwaj
Kartikeya Bhardwaj - avatar
2 Answers
0
If my knowledge, no. No custom operator overloading in Java except String concatenation.
18th Feb 2017, 5:39 AM
Jian-hua Yeh
Jian-hua Yeh - avatar
0
The answer is Identity Hash map . Because IdentityHashMap class is added in SDK 1.4. Keys hash codes are calculated not by using a hashCode method, but by using a System.identityHashCode method. This method is used to calculate a hash code at the object address in memory in Object.hashCode. Additionally, for objects comparison an IdentityHashCode class uses the == operator, instead of the equals method.
18th Feb 2017, 7:56 AM
Kartikeya Bhardwaj
Kartikeya Bhardwaj - avatar