title: Why lambdas passed as argument cannot redefine variable internally
body: <p>Why the Java Compiler don't allow us to create a homonymous variable in the function's local scope when we are passing a lambda as an argument?</p>
  
  <pre><code>import java.util.*;
  import java.util.function.*;
  
  public class MyClass {
      public static void main(String args[]) {
          Consumer&lt;String&gt; func = s -&gt; System.out.println(s);
  
          Set&lt;String&gt; s = new HashSet&lt;&gt;();
          s.add("lion");
          s.add("tiger");
          s.add("bear");
          s.forEach(s -&gt; System.out.println(s)); //it dont!
          //s.forEach(func); //it works!
      }
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>/MyClass.java:12: error: variable s is already defined in method main(String[])
          s.forEach(s -&gt; System.out.println(s));
                ^
  1 error
  </code></pre>