commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Janek Bogucki <...@studylink.com>
Subject RE: [collections] CollectionUtils.getCardinalityMap JavaDoc
Date Mon, 08 Sep 2003 18:00:16 GMT
On Mon, 2003-09-08 at 16:08, Arun Thomas wrote:
> I'm not sure if it makes sense to call it an "entry that maps to null" but consider that
the the cardinal map returned by this function will be accessed in the following manner:
> 
>  Integer x = returnedMap.get(obj);
> 
> That statement may just be pointing out that instead of returning Integer(0) for objects
that weren't in the collection, a null will be returned instead - as you pointed out, an object
not in the collection will not be mapped to anything, and so, when used as a key, will lead
to a null value.  
> 

Yep, the comment is useful in the context getFreq ( Object, Map ).

BTW, a possible optimization of getFreq would to remove the use of
exception handling as part of the expected code path and test for null
explicitly.

-Janek

Mime
View raw message