Predicate接口介绍
1、Predicate是Commons Collections中定义的一个接口。具体
import java.util.Collection;import org.apache.commons.collections.Predicate;/** * @author zoopnin * * 功能:判读集合中是否存在指定的对象 * * */public class ContainsPredicate implements Predicate {private final Collection<?> objs;public ContainsPredicate(Collection<?> objs) {super();this.objs = objs;}public boolean evaluate(Object object) {if (object instanceof Collection<?>) {return objs.containsAll((Collection<?>) object);} else {return objs.contains(object);}}}?
?
?