Effective Kotlin: Item 11 — Always override hashCode when you override equals
In Effective Java by Joshua Bloch, there are lots of details about how to write a hashCode function. With Kotlin’s
data class implementation, there is now often little need to write your own as it provides one for you.
As with item 10 which talks about implementing
equals, the main premise is to calculate the
hashCode based off your classes significant fields with the more unique the value, the better it is for storing in hash tables. Consider a
data class which has a unique identifier,