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