Object as a key in Hashmap – What are the constraints you will face?

When you want to use the Object of a custom class as a key in Hashmap, there are several things you need to consider, and that are Override hashCode() and equals() in custom class. The object of a custom class must be immutable. 1)¬†Override hashCode() and equals() in custom class. The reason behind overriding hashCode() …

Object as a key in Hashmap – What are the constraints you will face? Read More »