title: Java 8 forEach with index
body: <p>Is there a way to build a <code>forEach</code> method in Java 8 that iterates with an index? Ideally I'd like something like this:</p>
  
  <pre><code>params.forEach((idx, e) -&gt; query.bind(idx, e));
  </code></pre>
  
  <p>The best I could do right now is:</p>
  
  <pre><code>int idx = 0;
  params.forEach(e -&gt; {
    query.bind(idx, e);
    idx++;
  });
  </code></pre>