VOOZH about

URL: https://www.geeksforgeeks.org/java/java-util-function-doublepredicate-interface-in-java-with-examples/

⇱ Java.util.function.DoublePredicate interface in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Java.util.function.DoublePredicate interface in Java with Examples

Last Updated : 12 Jul, 2025

The DoublePredicate interface was introduced in JDK 8. This interface is packaged in java.util.function package. It operates on a Double object and returns a predicate value based on a condition. It is a functional interface and thus can be used in lambda expression also.
 

public interface DoublePredicate


Methods 
 

  • test(): This function evaluates a conditional check on the double value, and returns a boolean value denoting the outcome. 
boolean test(double value)
  • and(): This function applies the AND operation on the current object and the object received as argument, and returns the newly formed predicate. This method has a default implementation. 
default DoublePredicate and(DoublePredicate other)
  • negate(): This function returns the inverse of the current predicate i.e reverses the test condition. This method has a default implementation. 
default DoublePredicate negate()
  • or(): This function applies the OR operation on the current object and the object received as argument, and returns the newly formed predicate. This method has a default implementation. 
default DoublePredicate or(DoublePredicate other)


Example:  


Output: 
100 is less than 100 false
100 is greater than 100 false
81 is less than 100 true
49 is greater than 36 and less than 100 true

 

Reference: https://docs.oracle.com/javase/8/docs/api/java/util/function/DoublePredicate.html
 

Comment