You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Anirudh Vyas (JIRA)" <ji...@apache.org> on 2011/05/03 02:26:03 UTC

[jira] [Commented] (COLLECTIONS-88) [collection] Map filter with MapUtils.predicatedMap feature request

    [ https://issues.apache.org/jira/browse/COLLECTIONS-88?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13027952#comment-13027952 ] 

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.

Anirudh

> [collection] Map filter with MapUtils.predicatedMap feature request
> -------------------------------------------------------------------
>
>                 Key: COLLECTIONS-88
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-88
>             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: http://www.atlassian.com/software/jira