title: Replace forEach with Stream
body: <p>I have the below code</p>
  
  <pre><code>TreeMap&lt;Integer, List&lt;String&gt;&gt; myMap = new TreeMap&lt;&gt;();
  List&lt;Integer&gt; myList = getDataForTest(true);
  List&lt;String&gt; wordList = getWordList(true);
  List&lt;Integer&gt; intList = Collections.emptyList();
  intList = myObj.stream().filter(e-&gt;e.getType.equalsIgnoreCase("TEST")).map(e-&gt;e.getIntPos()).collect(Collectors.toList())
  AtomicInteger pos = new AtomicInteger(0);
  myList.stream()
              .forEach((entry) -&gt;{
                                  if(CollectionUtils.isEmpty(intList) || intList.contains(pos.get()))
                                  {
                                      myMap.computeIfAbsent(myList.get(pos.get()),k-&gt; new ArrayList&lt;&gt;()).add(wordList.get(pos.get()));
                                  }
                                  pos.incrementAndGet();
                                      });
  return myMap;
  </code></pre>
  
  <p>The above code will obviously throw a compilation error as I'm using the <strong>intList</strong> which is not final in the lambda. Is there a way to have this lambda replaced by stream.</p>