directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Knecht <fel...@apache.org>
Subject Re: Equals and HashCode
Date Mon, 17 May 2010 11:44:10 GMT
-----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 :(

What's bad in returning a sum of the has codes of each object hash code
used in the in the equals method?

> 
> This hashCodeBuilder() method is only called in one place in the whole
> code (ArrayUtils), and I'm not even sure it's useful.
> 
> Anyway, just use the commons-lang one in ArrayUtils, and delete this
> method from the code forever :)
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvxLAoACgkQ2lZVCB08qHGbaACg3Hsc8YcKoBKaRq7eQBFn0Mh5
/k0AoPARWKSU5OJZFKn/t0YaG90D+Q+L
=PPlF
-----END PGP SIGNATURE-----

Mime
View raw message