commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Neidhart <thomas.neidh...@gmail.com>
Subject Re: [collections] MultiValuedMap interface discussion
Date Mon, 31 Mar 2014 21:31:50 GMT
On 03/28/2014 12:47 AM, Ted Dunning wrote:
> Following Guava on this has something to be said for it.
> 
> https://code.google.com/p/guava-libraries/wiki/NewCollectionTypesExplained
> 
> Their decision is that Multimap#get returns a collection always.  If there
> are no values, then an empty collection is returned so that you can always
> do
> 
>       m.get(key).size()
> 
> or
> 
>      m.get(key).add(foo)
> 
> The value returned is a magical view which only takes up space on demand so
> there is little consing done.  There is an asMap method for which get will
> return null on missing keys.

the choice of guava is the most reasonable imho, thus I think we should
implement a similar behavior.

Thomas

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


Mime
View raw message