4 ms·
This feels like cargo culting of Java's hashCode (or similar) to me. As I understand it, hashCode is used as an optimization in the implementation of data struc
by tlrobinson 8y ago
This feels like cargo culting of Java's hashCode (or similar) to me. As I understand it, hashCode is used as an optimization in the implementation of data structures like hash maps and sets, not as the primarily equality check, since collisions can occur.
It would be simpler, faster, and more correct (no chance of collisions) to just implement an isEqual method.