commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: [math] When are OpenIntToDoubleHashMap instances equal? WAS Re: svn commit: r742257 - in /commons/proper/math/trunk/src: java/org/apache/commons/math/linear/ java/org/apache/commons/math/util/ test/org/apache/commons/math/linear/
Date Mon, 09 Feb 2009 11:37:19 GMT
Ok, sort of letting eclipse take over. More comments inline.

"Phil Steitz" <phil.steitz@gmail.com> wrote in message 
news:49901038.2070009@gmail.com...
> billbarker@apache.org wrote:
>
> Do we need this?
>> +        if (mask != other.mask)
>> +            return false;
>>   .

as the code stands now, unnecessary. The value can't be currently changed. 
More than happy to remove the check.

> ...
>
>
> Or this?
>> +        if (!Arrays.equals(states, other.states)){
>>
> It would seem reasonable to me that two OpenIntToDoubleHashMaps would be 
> equal iff they contain they contain the same entries and have the same 
> default (missingEntries).   Including the private fields above in equals 
> will make it more sensitive than that.  Since mask relates to capacity, I 
> guess it could make sense to include that in equals comparisons, but 
> unless I am misunderstanding how put works, I think that including states 
> in the comparison could make two instances unequal if their entries have 
> been added in different orders.  Do we want this?
>

I'm thinking probably not.  I agree with your def of equals for 
OpenIntToDoubleHashMap, so will change it.

> Phil 




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


Mime
View raw message