Stream concept has been introduced in Java 1.8. Stream concept is used to work on collection objects using stream() method.

Some of the methods which would be used for this program are as below:

(1.) stream() method: This method returns a sequential Stream with the collection on which it is applied as its source.
e.g.
List list = new ArrayList();
list.add(180);
list.add(31);
Stream stream = list.stream();

(2.) filter() method: This method returns a stream consisting of the elements of this stream that match the given predicate.

(3.) collect() method : This method performs a mutable reduction operation on the elements of this stream using a Collector i.e. this method collects all the results which statisfy the filter criteria.

Demo Program to Print Even Numbers Using Stream Concept:

package com.masterjavatutorial;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Test {
    public static void main(String[] args) {
	
         List list = new ArrayList();	
         list.add(180);
         list.add(31);
         list.add(40);
         list.add(77);
         list.add(2376);
         list.add(2561);
         list.add(29);
         list.add(14);
         
         Stream stream = list.stream(); 
         List listOfEvenNumbers = stream.filter(i->i%2==0).collect(Collectors.toList());
         System.out.println(listOfEvenNumbers); 
		
    }

}

Output of the above program is as below:

[180, 40, 2376, 14]