1.

What Is The Requirement For An Object To Be Used As Key Or Value In Hashmap?

Answer»

The KEY or VALUE OBJECT must implement equals() and hashcode() method. The hash code is used when you insert the key object into the map while equals are used when you TRY to retrieve a value from the map.

The key or value object must implement equals() and hashcode() method. The hash code is used when you insert the key object into the map while equals are used when you try to retrieve a value from the map.



Discussion

No Comment Found