- Type Parameters:
T- 参数1的类型U- 参数2的类型
- All Superinterfaces:
BiPredicate<T,,U> Serializable
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
可序列化的BiPredicate接口,支持异常抛出和逻辑组合操作。
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Method Summary
Modifier and TypeMethodDescriptiondefault BiPredicateX<T, U> and(BiPredicateX<? super T, ? super U> other) 返回一个组合谓词,表示此谓词与另一个谓词的短路逻辑与。default BiPredicateX<T, U> negate()返回一个表示此谓词逻辑非的谓词。default BiPredicateX<T, U> or(BiPredicateX<? super T, ? super U> other) 返回一个组合谓词,表示此谓词与另一个谓词的短路逻辑或。default boolean对给定的两个参数评估此谓词,自动处理异常。boolean对给定的两个参数评估此谓词,可能抛出异常。Methods inherited from interface java.util.function.BiPredicate
and, or
-
Method Details
-
testing
对给定的两个参数评估此谓词,可能抛出异常。- Parameters:
t- 第一个输入参数u- 第二个输入参数- Returns:
- 如果参数匹配谓词返回true,否则返回false
- Throws:
Throwable- 可能抛出的异常
-
test
对给定的两个参数评估此谓词,自动处理异常。- Specified by:
testin interfaceBiPredicate<T,U> - Parameters:
t- 第一个输入参数u- 第二个输入参数- Returns:
- 如果参数匹配谓词返回true,否则返回false
- Throws:
RuntimeException- 包装后的运行时异常
-
and
返回一个组合谓词,表示此谓词与另一个谓词的短路逻辑与。如果此谓词为false,则不评估另一个谓词。- Parameters:
other- 与此谓词进行逻辑与的谓词- Returns:
- 组合谓词,表示此谓词与other谓词的短路逻辑与
- Throws:
NullPointerException- 如果other为null
-
negate
返回一个表示此谓词逻辑非的谓词。- Specified by:
negatein interfaceBiPredicate<T,U> - Returns:
- 表示此谓词逻辑非的谓词
-
or
返回一个组合谓词,表示此谓词与另一个谓词的短路逻辑或。如果此谓词为true,则不评估另一个谓词。- Parameters:
other- 与此谓词进行逻辑或的谓词- Returns:
- 组合谓词,表示此谓词与other谓词的短路逻辑或
- Throws:
NullPointerException- 如果other为null
-