commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anirudh Vyas (JIRA)" <>
Subject [jira] [Commented] (COLLECTIONS-88) [collection] Map filter with MapUtils.predicatedMap feature request
Date Tue, 03 May 2011 00:26:03 GMT


Anirudh Vyas commented on COLLECTIONS-88:

I don't buy that argument, I can submit the patch if thats what it takes, I still feel this
is a valid issue, and the method should be called filter( ) on MapUtils, that solution being
described is ugly. My 2 cents.


> [collection] Map filter with MapUtils.predicatedMap feature request
> -------------------------------------------------------------------
>                 Key: COLLECTIONS-88
>                 URL:
>             Project: Commons Collections
>          Issue Type: Bug
>    Affects Versions: 3.1
>         Environment: Operating System: other
> Platform: Other
>            Reporter: Luc Carpentier
> Hello,
> I stumbled into the following problem:
> A client submits an http request with prefixed parameters. Each prefix will 
> have it's own javabean to populate. So if there are two prefixes, then there 
> will be two different javabeans to populate from the request parameters.
> I created a PrefixPredicate that only allows values with a specific prefix. I 
> then used this PrefixPredicate to copy the Map with the request parameters to 
> a predicated Map with:
> Map predicatedMap = MapUtils.predicatedMap(dataMap,keyPredicate,null);
> However, since the request parameters contain parameters with other prefixes 
> as well, this returns an IllegalArgumentException.
> It would be nice to be able to specify to the MapUtils.predicatedMap method to 
> ignore entries that do not comply to the predicate instead of to throw an 
> exception.
> There are lots of possabilities to filter on a Collection, but a Map is not a 
> collection...

This message is automatically generated by JIRA.
For more information on JIRA, see:

View raw message