If I overload equals should I still override haschode in java? -


i know should override hascode everytime override equals overloading? should still override hashcode?

side note: before posting question i've read should avoid overloading equals in first place i'd still know should if i'd choose overload it.

no hash-based collection ever use overloaded equals() method. it's method, , decide should do. contract entirely yours.

but i'll repeat said in question: shouldn't overload equals() in first place. if do, should @ least make consistent actual equals(object) method avoid confusions. , since should consistent equals(), means need override equals(object), , override hashcode().


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -