import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
class Main {
public static void main(String[] args) {
List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
List<Integer> evens = list.stream()
.filter(e -> e % 2 == 0)
.collect(Collectors.toList());
System.out.println(evens);
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: