首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Predicate接口引见

2012-11-13 
Predicate接口介绍1、Predicate是Commons Collections中定义的一个接口。具体import java.util.Collectioni

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);}}}

?

?

?

热点排行