How do you make an employee object a key in HashMap?

If you want to make a mutable object as key in hashmap, then you have to make sure that state change for key object does not change the hash code of object. This can be done by overriding the hashCode() method . But, you must make sure you are honoring the contract with equals() also.

Sizin İçin Seçtik  Akış tipi üretim nedir?

Leave a Reply

Your email address will not be published. Required fields are marked *