title: Java 8 Function Reference With Arguments
body: <p>Trying to understand how to reference Instance functions. I've figured out how to define getters, but setters are giving me trouble. I'm not sure how to write a function for a given method signature and a given base class.</p>
  
  <p><strong>What type is <code>Foo::setBar</code> below?</strong></p>
  
  <pre><code>public class Foo {
      private String bar;
  
      public String getBar() {
          return bar;
      }
  
      public void setBar(String bar) {
          this.bar = bar;
      }
  }
  
  
  {
      //Works great!
      Function&lt;Foo, String&gt; func1 = Foo::getBar;
  
      //Compile error ?
      Function&lt;Foo, String&gt; func2 = Foo::setBar;
      //Compile error ?
      Function&lt;Foo, Void, String&gt; func3 = Foo::setBar;
  }
  </code></pre>