title: Modifying local variable from inside lambda
body: <p>Modifying a local variable in <code>forEach</code> gives a compile error:</p>
  
  <p><strong>Normal</strong></p>
  
  <pre><code>    int ordinal = 0;
      for (Example s : list) {
          s.setOrdinal(ordinal);
          ordinal++;
      }
  </code></pre>
  
  <p><strong>With Lambda</strong></p>
  
  <pre><code>    int ordinal = 0;
      list.forEach(s -&gt; {
          s.setOrdinal(ordinal);
          ordinal++;
      });
  </code></pre>
  
  <p>Any idea how to resolve this?</p>