1.

What is the requirement for an object to be used as key or value in HashMap?

Answer»

  • The key or value object that gets used in the hashmap must implement equals() and hashcode() method.

  • The hash code is used when inserting the key object into the map and the equals method is used when trying to retrieve a value from the map.




Discussion

No Comment Found