title: Unexpected Java Functional Interface conversion
body: <p>I have the following piece of code, that uses java Functional Interfaces, that compiles, but it's not clear why does it compile:</p>
  
  <pre><code>public class App {
  
      public static void main(String[] args) throws Exception {
  
          final RecordIterator it = new RecordIterator&lt;MyRecord&gt;();
  
          final UpdateManager updateManager = new UpdateManager();
          updateManager.doUpdateForEach(it, DatabaseOperator::updateInfo);
  
      }
  }
  
  class UpdateManager {
  
      public void doUpdateForEach(final RecordIterator recordIterator,
                                  final FunctionalStuff&lt;MyRecord&gt; updateAction) throws Exception {
  
          updateAction.execute(new DatabaseOperator(), new MyRecord());
  
      }
  
  }
  
  class RecordIterator&lt;E&gt; {
  
  }
  
  @FunctionalInterface
  interface FunctionalStuff&lt;T&gt; {
  
      void execute(final DatabaseOperator database, final T iterator) throws Exception;
  
  }
  
  class DatabaseOperator {
  
      public void updateInfo(final MyRecord r) {
  
      }
  
  }
  
  class MyRecord {
  
  }
  </code></pre>
  
  <p>So, my confusion is inside of the <code>main</code> method:</p>
  
  <ul>
  <li>the last line of the main method is <code>updateManager.doUpdateForEach(it, DatabaseOperator::updateInfo);</code></li>
  <li>the <code>UpdateManager#doUpdateForEach</code> method expects a <code>RecordIterator</code> (ok, makes sense), and a <code>FunctionalStuff</code></li>
  <li><code>FunctionalStuff</code> has a single method (obviously), that receives 2 params</li>
  <li>The second argument of the <code>doUpdateForEach</code> is a method reference (<code>DatabaseOperator::updateInfo</code>)</li>
  <li>The <code>DatabaseOperator::updateInfo</code> method receives a single argument</li>
  </ul>
  
  <p>how does this compiles? How is the <code>DatabaseOperator::updateInfo</code> method reference converted into the functional interface? Am I missing something obvious? Or is some corner case of functional interfaces? </p>