commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Shayan (JIRA)" <j...@apache.org>
Subject [jira] Commented: (COLLECTIONS-306) Use Predicate in subtract
Date Sat, 08 Nov 2008 12:12:46 GMT

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

Chris Shayan commented on COLLECTIONS-306:
------------------------------------------

I've developed the method myself please test it by other developers, the code is:

    public static Collection subtract(final Collection a, final Collection b, Predicate
p) {  
        ArrayList list = new ArrayList(a);  
        for (int i = 0; i < list.size(); i++) {  
            Object o = list.get(i);  
            if(!p.evaluate(o)) {  
                list.remove(i);  
            }  
        }  
        return list;  
    }  

> Use Predicate in subtract
> -------------------------
>
>                 Key: COLLECTIONS-306
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-306
>             Project: Commons Collections
>          Issue Type: New Feature
>          Components: Collection
>         Environment: all OSs
>            Reporter: Chris Shayan
>   Original Estimate: 0.75h
>  Remaining Estimate: 0.75h
>
> It is good idea to use Predicate in subtract method, I've developed myself the mentioned
method and now I am testing it. I mean we should have following methods:
> The one already exist is:
> public static Collection subtract(Collection a, Collection b)
> I offer to have one more which is:
> public static Collection subtract(Collection a, Collection b, Predicate predicate)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message