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:

Author

  • Deepak Verma

    Deepak Verma is a Test Automation Consultant and Software development Engineer for more than 10 years. His mission is to help you become an In-demand full stack automation tester. He is also the founder of Techndeck, a blog and online coaching platform dedicated to helping you succeed with all the automation basics to advanced testing automation tricks.