How to print a count in Collections.forEach()
<p>So I've got a list as follows, with the lambda expression:</p>

<pre><code>ArrayList&lt;String&gt; array = new ArrayList&lt;&gt;();
...
StringBuffer buf = new StringBuffer("");
array.stream().forEach((item) -&gt; {
    buf.append("Counter here: " + item.toString() + "\n");
});
return buf.toString();
</code></pre>

<p>But i can't instantiate and modify a variable within the <code>forEach</code> lambda expression because it has to be <code>final</code>. Is there a way i can do this?</p>