I\'m looking for a solution to generate a checksum for any type of Java object, which remains the same for every execution of an application that produces the same object.>
Hashcode is OK. Either given class overrides equals
and also, as contract demands, hashcode
. By contract, if equals
returns true
hashcode must be the same.
Or class doesn't override equals
. In this case different executions of your application cannot produce same object, so there is no problem.
The only problem is that some classes (even from Java API) break contract for equals
.