commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <>
Subject [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:15:04 GMT wrote:

 Do we need this?
> +        if (mask != other.mask)
> +            return false;

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?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message