public interface Predicate
| java.util.function.Predicate<T> |
表示一个参数的谓词(布尔值函数)。
这是一个 functional interface,其功能方法是 test(Object) 。
公共方法(Public methods) |
|
|---|---|
default Predicate<T> |
and(Predicate<? super T> other) 返回一个组合谓词,表示谓词与其他谓词的短路逻辑AND。 |
static <T> Predicate<T> |
isEqual(Object targetRef) 根据 |
default Predicate<T> |
negate() 返回表示谓词逻辑否定的谓词。 |
default Predicate<T> |
or(Predicate<? super T> other) 返回一个组合谓词,表示谓词与其他谓词的短路逻辑或。 |
abstract boolean |
test(T t) 根据给定的参数评估这个谓词。 |
Predicate<T> and (Predicate<? super T> other)
返回一个组合谓词,表示谓词与其他谓词的短路逻辑AND。 在评估组合谓词时,如果此谓词为false ,则不评估other谓词。
在判断谓词期间抛出的任何异常都会传递给调用者; 如果此谓词的评估引发异常,则不会评估other谓词。
| 参数(Parameters) | |
|---|---|
other |
Predicate: a predicate that will be logically-ANDed with this predicate |
| 返回(Returns) | |
|---|---|
Predicate<T> |
a composed predicate that represents the short-circuiting logical AND of this predicate and the other predicate |
| 抛出异常(Throws) | |
|---|---|
NullPointerException |
if other is null |
Predicate<T> isEqual (Object targetRef)
根据 equals(Object, Object)返回一个判断两个参数是否相等的 equals(Object, Object) 。
| 参数(Parameters) | |
|---|---|
targetRef |
Object: the object reference with which to compare for equality, which may be null |
| 返回(Returns) | |
|---|---|
Predicate<T> |
a predicate that tests if two arguments are equal according to equals(Object, Object) |
Predicate<T> negate ()
返回表示谓词逻辑否定的谓词。
| 返回(Returns) | |
|---|---|
Predicate<T> |
a predicate that represents the logical negation of this predicate |
Predicate<T> or (Predicate<? super T> other)
返回一个组合谓词,表示谓词与其他谓词的短路逻辑或。 在评估组合谓词时,如果此谓词为true ,则不评估other谓词。
在判断谓词期间抛出的任何异常都会传递给调用者; 如果此谓词的评估引发异常,则不会评估other谓词。
| 参数(Parameters) | |
|---|---|
other |
Predicate: a predicate that will be logically-ORed with this predicate |
| 返回(Returns) | |
|---|---|
Predicate<T> |
a composed predicate that represents the short-circuiting logical OR of this predicate and the other predicate |
| 抛出异常(Throws) | |
|---|---|
NullPointerException |
if other is null |
boolean test (T t)
根据给定的参数评估这个谓词。
| 参数(Parameters) | |
|---|---|
t |
T: the input argument |
| 返回(Returns) | |
|---|---|
boolean |
true if the input argument matches the predicate, otherwise false |