62,615
社区成员
发帖
与我相关
我的任务
分享
default Predicate<T> and(Predicate<? super T> other) {
Objects.requireNonNull(other);
//为什么能够返回Predicate类型的对象
return (t) -> test(t) && other.test(t);
}
return (t) -> (test(t) && other.test(t));
default Predicate<T> and(Predicate<? super T> other) {
Objects.requireNonNull(other);
//return (t) -> test(t) && other.test(t);
return new Predicate<T>(){
@Override
public boolean test(T t) {
// TODO Auto-generated method stub
return this.test(t) && other.test(t);
}
};
}
default Predicate<T> and(Predicate<T> other) {
Objects.requireNonNull(other);
//为什么能够返回Predicate类型的对象
//return (t) -> test(t) && other.test(t);
return new Predicate(){
@Override
public boolean test(Object o) {
return this.test(o) && other.test(o);
}
};
}