DoublePredicate and example
Description
DoublePredicate and returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
Syntax
and
has the following syntax.
default DoublePredicate and(DoublePredicate other)
Example
The following example shows how to use and
.
import java.util.function.DoublePredicate;
//ww w . ja va 2 s . c om
public class Main {
public static void main(String[] args) {
DoublePredicate dp = (d) -> d > 0;
DoublePredicate dp1 = (d) -> d == 0;
System.out.println(dp.and(dp1).test(0.5));
}
}
The code above generates the following result.
Home »
Java Lambda »
java.util.function Reference »
Java Lambda »
java.util.function Reference »