Write a program to return list of all even numbers that are greater than 5 in list.

package mv;

import java.util.Arrays;
import java.util.stream.Collectors;
import java.util.*;
public class GreaterFive {

public static void main(String[] args) {

    List<Integer> list=Arrays.asList(1,2,3,4,5,6,7,8,9,10);
    List<Integer> greterThanFive=list.stream().filter(i->i%2==0 && i >5).collect(Collectors.toList());
    System.out.println(greterThanFive);

}

}

Leave a Reply

Your email address will not be published. Required fields are marked *

*