import java.util.*; import java.util.stream.*; public class JavaHungry { public static void main(String args[]) { List<Integer> myList = Arrays.asList(10,15,8,49,25,98,32); myList.stream() .filter(n -> n%2 == 0) .forEach(System.out::println); } }
Output:
10, 8, 98, 32
Don't miss the next article!
Be the first to be notified when a new article or Kubernetes experiment is published.
Share This