In Java 8 - Find all even numbers greater than 2










Program/ Example -
   //In Java 8 - Find all even numbers greater than 2
       //Use streams
          IntStream.of(1, 2, 3, 4, 5)  //Numbers between 1 to 5
        .filter(n -> n > 2) //Find all numbers greater than 2
        .filter(n -> n % 2 == 0) //Filter - all even numbers
        .forEach(System.out::println); //display
             


Having any doubt? or you you liked the tutorial! Please comment in below section.
Please express your love by liking JavaMadeSoEasy.com (JMSE) on facebook, following on google+ or Twitter.





Must read for you :