commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sujit Pal <>
Subject Re: [math] Shoud OpenIntToDoubleHashMap get return NaN instead of 0 for key not found?
Date Fri, 02 Jan 2009 16:56:55 GMT
If OpenIntToDoubleHashMap returns NaN for non-existent keys, then the 
Sparse Matrix could check for NaN to return 0 to its client.


Phil Steitz wrote:
> I am still working through this class and the sparse matrix class that 
> it was extracted from (thanks, Ismael and Sugit!), so I am not sure if 
> changing this would cause problems, but the current setup (returning 0 
> for missing keys) limits usefulness of this class.   I see how this is 
> convenient for sparse matrices; but I would see NaN as a more natural 
> return value for non-existent keys in the general case.  
> Alternatively,  I guess we could add another method get(int key, 
> double missingReturn).
> Thoughts?
> Phil
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message