Can a HashMap key be mutable?

The answer is NO . Making keys in any hashing data structure will cause memory leak. If we make the keys mutable then the hashcode() of the key will no more be consistent over time which will cause lookup failure for that object from the data structure.3 Ağu 2019

Sizin İçin Seçtik  How do you make an employee object a key in HashMap?

Leave a Reply

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