In this post, we will see how to double the even and odd numbers present in an ArrayList separately with the help of Java 8 Streams.

Let’s say: There is an ArrayList of 10 integer values as shown below. In the first example, using Streams, we are going to double each even integer of the ArrayList and In the second example, we are going to double odd integers.

Example 1



Example 2



That’s it. It’s that easy to double the even and odd numbers of ArrayList with the power of Java 8 Streams.

If you like this post, please check out my other similar posts:

How to add/sum up the ArrayList integers using Java8 Streams



     Java 8 Streams


  • 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. Verma Deepak