You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Emmanuel Bourg <eb...@apache.org> on 2005/08/23 17:47:46 UTC

[configuration] Implementing equals & hashCode in AbstractConfiguration

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