title: Perform action inside stream of operation in Java 8
body: <p>I have a requirement to get the count of employees where employee name contains "kumar" and age is greater than 26. I am using Java 8 streams to iterate over the collection and I'm able to find employee count with above said condition.</p>
  
  <p>But, in the meantime, I need to print the employee details.</p>
  
  <p>Here's my code using Java 8 streams:</p>
  
  <pre><code>public static void main(String[] args) {
  
      List&lt;Employee&gt; empList = new ArrayList&lt;&gt;();
  
      empList.add(new Employee("john kumar", 25));
      empList.add(new Employee("raja", 28));
      empList.add(new Employee("hari kumar", 30));
  
      long count = empList.stream().filter(e -&gt; e.getName().contains("kumar"))
                            .filter(e -&gt; e.getAge() &gt; 26).count();
      System.out.println(count);
  }
  </code></pre>
  
  <p>Traditional way:</p>
  
  <pre><code>public static void main(String[] args){
     List&lt;Employee&gt; empList = new ArrayList&lt;&gt;();
  
      empList.add(new Employee("john kumar", 25));
      empList.add(new Employee("raja", 28));
      empList.add(new Employee("hari kumar", 30));
      int count = 0;
      for (Employee employee : empList) {
  
          if(employee.getName().contains("kumar")){
              if(employee.getAge() &gt; 26)
              {
                  System.out.println("emp details :: " + employee.toString());
                  count++;
              }
          }
      }
       System.out.println(count);
  }
  </code></pre>
  
  <p>Whatever I am printing in the traditional way, I want to achieve the same using streams also.</p>
  
  <p>How do I print a message within each iteration when using streams?</p>