directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <elecha...@gmail.com>
Subject Re: Equals and HashCode
Date Sun, 16 May 2010 22:03:58 GMT
On 5/16/10 11:37 PM, Felix Knecht wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>    
>> Definitively not a false positive. Implementing the equals() method does
>> not works if we don't implement hashcade() at the same time.
>>      
> IMO we can use for most HashCodeBuilder [1] and appending the same
> fields used in the equals method.
> Do you think this is a way to go or does this end up in performance issues?
>    

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).

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 :)

-- 
Regards,
Cordialement,
Emmanuel L├ęcharny
www.nextury.com



Mime
View raw message