0 votes
in DBMS by

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

1 Answer

0 votes
by
  • 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.

Related questions

+1 vote
asked Dec 4, 2022 in DBMS by SakshiSharma
0 votes
asked Aug 10, 2023 in DBMS by DavidAnderson
...