In this post, we will see “How to check odd or even numbers within a certain range using Java 8 Streams API”.

Easiest representation of Java 8 Streams power to test Odd or Even numbers within a certain range...!!! Share on X

Let’s say: In this particular example, we are extracting the odd and even numbers within the range of 10 to 25

Note: you can specify any range you would like to check for in place of the one we used in this example.

Example

 

Output:

 

Easiest representation of Java 8 Streams power to test Odd or Even numbers within a certain range...!!! Share on X

 

That’s it, Java 8 Streams API is so powerful and notice how shortened and understandable the code is.

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.

    http://Techndeck.com deepak.rkgit@gmail.com Verma Deepak