title: How do you assign a lambda to a variable in Java 8?
body: <p>Just playing with the new lambda and functional features in Java 8 and I'm not sure how to do this. </p>
  
  <p>For example the following is valid:</p>
  
  <pre><code>    Map&lt;String, Integer&gt; map = new HashMap&lt;&gt;();
      map.put("A", 1);
      map.put("B", 2);
      map.put("C", 3);
      map.compute("A", (k, v) -&gt; v == null ? 42 : v + 41));
  </code></pre>
  
  <p>but the following gives me syntax errors:</p>
  
  <pre><code>    BiFunction x = (k, v) -&gt; v == null ? 42 : v + 41;
      map.compute("A", x);
  </code></pre>
  
  <p>Any ideas?</p>