commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Colebourne <scolebou...@btopenworld.com>
Subject Re: [collections] ReversePredicate
Date Fri, 28 Apr 2006 20:35:27 GMT
This looks like NotPredicate to me ;-)

Stephen


Lazarte, Ivan wrote:
> I didn't see a reverse predicate object in the 3.1 api, so I wrote one
> quickly.  Enjoy!
> 
>  
> 
> package your.package.goes.here.dude;
> 
>  
> 
> import org.apache.commons.collections.Predicate;
> 
>  
> 
> /**
> 
>  * Take a predicate as a value and reverse the sign.
> 
>  */
> 
>  
> 
> public class ReversePredicate implements Predicate {
> 
>  
> 
>             Predicate predicate;
> 
>             
> 
>             public ReversePredicate(Predicate predicate) {
> 
>                         this.predicate = predicate;
> 
>             }
> 
>  
> 
>             public boolean evaluate(Object object) {
> 
>                         return (predicate.evaluate(object) == true) ?
> false : true;
> 
>             }
> 
> }
> 
>  
> 
> Ivan Lazarte
> Web Application Developer
> The Away Network
> (p) 202.654.8046
> (f)  202.654.8081
> 1001 G St. NW
> Suite 725W
> Washington, DC 20001
> | Away.com | Outside Online | GORP.com |
> 
>  
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message