commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lazarte, Ivan" <i...@away.com>
Subject RE: [collections] ReversePredicate
Date Mon, 01 May 2006 20:35:49 GMT
Blarg! Curse my tired eyes...  thanks :)

-----Original Message-----
From: Stephen Colebourne [mailto:scolebourne@btopenworld.com] 
Sent: Friday, April 28, 2006 4:35 PM
To: Jakarta Commons Users List
Subject: Re: [collections] ReversePredicate

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


---------------------------------------------------------------------
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