BiPredicate or returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
or
has the following syntax.
default BiPredicate<T,U> or(BiPredicate<? super T,? super U> other)
The following example shows how to use or
.
import java.util.function.BiPredicate; /*w ww. j av a2 s . c om*/ public class Main { public static void main(String[] args) { BiPredicate<Integer, Integer> bi = (x, y) -> x > y; BiPredicate<Integer, Integer> eq = (x, y) -> x -2 > y; System.out.println(bi.test(2, 3)); System.out.println(bi.or(eq).test(2, 3)); System.out.println(bi.or(eq).test(8, 3)); } }
The code above generates the following result.