title: Java 8 Stream run 1 function every index while another every n times
body: <p>Whats the best way to iterate over a Java 8 Stream such that I can perform one function for every element (forEach) while another for every 10 element. Every element using foreach displayed below. What function can I use .to intercept the eveyr nth element and perform the 2nd function call?</p>
  
  <p>Sample code below : -</p>
  
  <pre><code>Stream&lt;String&gt; strings = Files.lines(path); //some stream
  
  stream.forEach(s -&gt; System::println)// every element but how can i perform 
  </code></pre>