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 collec
Thanks Ted for pointing to this.
I checked out the guavas Multimap and if I understand correctly, they are
returning a wrapped Collection with an internal reference to the Multimap.
The basic behavior is
- When add is triggered on the collection, they create the mapping in
their Multimap if it is
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
The downside of it returning an empty collection is you either have (1) to
instantiate a collection just to say you have nothing or (2) you use an
immutable collection. #1 is bad in itself and #2 is only as bad if the
collection is otherwise writable. For example, it would be really strange
for the