DoublePredicate negate example
Description
Returns a predicate that represents the logical negation of this predicate.
Syntax
negate
has the following syntax.
default DoublePredicate negate()
Example
The following example shows how to use negate
.
import java.util.function.DoublePredicate;
/*from w w w .j a v a 2 s . c o m*/
public class Main {
public static void main(String[] args) {
DoublePredicate dp = (d) -> d > 0;
System.out.println(dp.test(0.5));
System.out.println(dp.negate().test(0.5));
}
}
The code above generates the following result.
Home »
Java Lambda »
java.util.function Reference »
Java Lambda »
java.util.function Reference »