commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Bourg <ebo...@apache.org>
Subject [configuration] Implementing equals & hashCode in AbstractConfiguration
Date Tue, 23 Aug 2005 15:47:46 GMT
Oliver Heger wrote:
>> Sorry the commit was incomplete, this test assumes the configuration 
>> defines its equals() methods. I added an equals() method in 
>> AbstractConfiguration delegating to 
>> StrictConfigurationComparator.compare() but I'm not sure it's worth 
>> committing this. What do you think ? I'll fix the test if we rule out 
>> this suggestion.
>>
>> Emmanuel Bourg
> 
> I am not too convinced about the value of an equals() method either. 
> Comparing two Configuration objects does not seem to be such a common 
> task. And if it is needed, the comparator class can be used directly. If 
> there was an equals() method, how would you implement hashCode()?

hashCode() could be implemented as the sum of the hashCodes of the keys, 
or as the number of properties in the configuration.

Emmanuel Bourg

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message