title: Java 8 for-loop inconsistency: List of BinaryOperator vs List of Integer
body: <p>In the following Java 8 code snippet, the intention is to iterate through a list of binary (2-arg) operators / lambda functions. Eclipse generates the error <code>The method o(int,int) is undefined for the type X</code>. The error is associated with the loop variable <code>o</code>. In case it is relevant, the version of Eclipse is "Eclipse Java EE IDE for Web Developers", Mars Release (4.5.0).</p>
  
  <pre><code>import java.util.List;
  import java.util.function.BinaryOperator;
  public class X {
      public void f(List&lt;BinaryOperator&lt;Integer&gt;&gt; op) {
          for (BinaryOperator&lt;Integer&gt; o : op) {
              int x = o(1,2);
          }
      }
  }
  </code></pre>
  
  <p>However, if the type of op is changed to List, there is no compiler error.</p>
  
  <pre><code>public void f(List&lt;Integer&gt; op) {
      for (Integer o : op) {
          int x = o;
      }
  }
  </code></pre>
  
  <p>Why does the for-loop work for <code>List&lt;Integer&gt;</code> but not for <code>List&lt;BinaryOperator&lt;Integer&gt;&gt;</code>, and how should lists of lambda functions be iterated in Java 8?</p>