how should section exam hashcode-equals contract?
in nutshell, hashcode contract, according java's object.hashcode():
- the crush formula shouldn't change unless something inspiring equals() changes
- equals() implies crush codes ==
let's assume seductiveness essentially permanent information objects - information never changes after they're constructed, #1 feigned hold. leaves #2: problem simply confirming equals implies crush formula ==.
obviously, can't exam each fathomable information vigilant unless set trivially small. so, best proceed section exam approaching locate common cases?
since instances category immutable, there unparalleled ways make such an object; section exam should cover possible. off tip head, opening points constructors, deserialization, constructors subclasses (which should reducible constructor problem).
[i'm going try answer possess doubt around research. quarrel smoke-stack ers acquire reserve apparatus process.]
[this convenient oo languages, i'm adding tag.]
Comments
Post a Comment