Given a list of integers, find out all the even numbers that exist in the list using Stream functions?

This program filters all even numbers from a list of integers using Stream functions.

Code Example:

import java.util.*;
import java.util.stream.*;

public class EvenNumber {

    public static void main(String args[]) {

        List<Integer> list = Arrays.asList(10, 15, 8, 49, 25, 98, 32);

        list.stream()
                .filter(n -> n % 2 == 0)
                .forEach(System.out::println);
    }
}

Output:

10 8 98 32