Automatically generate equals & hashCode methods

Hello!
I just saw that I should override the equal and hashCode method, when I’m using an array in a data class.


My suggestion is that this will be auto generated by the compiler, so it checks every value etc.

Coming: https://youtrack.jetbrains.com/issue/KT-15893. Granted I disagree w/ the original design. I would have preferred that the data class hashCode/equals did what was most ergonomic for arrays and others. The argument was that they need to use equals/hashCode on the java.lang.Object without checking whether it was an array at runtime, but I don’t think it applies on specific array types and for base Any types the problem of using arrays persists. Too late now though.

1 Like