-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/17/10 15:30, Emmanuel Lecharny wrote: > On 5/17/10 1:44 PM, Felix Knecht wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> >>> IMO, writing a decent HashCode() method is simple. No need to use this >>> HashCodeBuilder that don't lnow how to deal with Object (it simply add >>> the object.hashcode() to the computed hash code, which is bad). >>> >> I don't see whats bad doing so. The rule is "if two objects are equal, >> then their hashCode values must be equal as well". As a very bad >> solution we can just return 1111 in every case :( >> > It's bad as it carries the semantic, not the logic. In other words, ypu > may have two objects considered as different when they are equals, just > because you were too lazzy to implement the hashcode method. I give you > an example : comparing two Entry instance in the server is just about > comparing their DN, nothing else. If you call the HashcodeBuilder on it, > you will get errors if the Attributes are the same, but stored in a > different order, which is not expected.
I see. Thanks for explanation. > > Of course, this is a case by case issue. > > What I mean here is that hashcode computation must be contextual. > -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvxRbgACgkQ2lZVCB08qHHqZACcCx+jp4oGRqouKM975ZQTEwaS 0twAniZ3wfWrliOofo/p9euHZQJ/6IVW =821N -----END PGP SIGNATURE-----
