title: Local variable log defined in an enclosing scope must be final or effectively final
body: <p>I'm new to lambda and Java8. I'm facing following error. </p>
  
  <blockquote>
    <p>Local variable log defined in an enclosing scope must be final or
    effectively final</p>
  </blockquote>
  
  <pre><code>public JavaRDD&lt;String&gt; modify(JavaRDD&lt;String&gt; filteredRdd) {
  
      filteredRdd.map(log -&gt; {
  
          placeHolder.forEach(text -&gt; {
  
              //error comes here
              log = log.replace(text, ",");
  
          });
  
          return log;
  
      });
  
      return null;
  }
  </code></pre>