commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bennetts <moneyista...@gmail.com>
Subject Re: [collections] MultiValueMap with a custom value collection type
Date Tue, 01 Apr 2014 03:32:51 GMT
Hi Thomas

Thanks very much for your reply. I'll look forward to version 4.1, but in
the meantime I'll go with your suggested code.

Thanks again,

-- Ryan

 > Hello all
> >
> > I am having trouble understanding how to use a custom value collection
> type
> > with a MultiValueMap...
>


> Hi Ryan,
>
> we know that the MultiValueMap is flawed for several reasons, but we are
> working on adding a revamped variant in 4.1, see the issue:
>
> https://issues.apache.org/jira/browse/COLLECTIONS-508
>
> The best thing you can do right now is to instantiate it in the
> pre-generics way:
>
> @SuppressWarnings({ "rawtypes", "unchecked" })
> MultiValueMap<String, String> orderedMap
>   = MapUtils.multiValueMap(new LinkedHashMap(), LinkedHashSet.class);
>
> You actually need type-safety for orderedMap, not for the argument to
> multiValueMap. The need to suppress warnings is annoying, but with 4.1
> this should also go away.
>
> Thomas
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message