In this post, we will learn “How to use Predicate ‘not’ method introduced in Java 11?”. 

Here, we are going to learn the following things:

  1. What is the Predicate not() method?
  2. How to use it?

Predicate not() in Java 11...!!! Click To Tweet

Let’s Begin,

1. What is the Predicate not() method?

This method returns a predicate that is the logical negation of the given predicate.

2. How to use it?

Let’s take an example where we have the lambda expression to retrieve ‘Even’ numbers and to get ‘Odd’ numbers, we are going to use ‘not()’ method. 

Output:

Predicate not() in Java 11...!!! Click To Tweet

Do you like this Post? – then check my other helpful posts:

Other Useful References: