title: How to use method reference in Java 8 for Map merge?
body: <p>I have following 2 forms of calling a collect operation, both return same result, but I still cannot depend fully on method references and need a lambda. </p>
  
  <pre><code>&lt;R&gt; R collect(Supplier&lt;R&gt; supplier,
            BiConsumer&lt;R,? super T&gt; accumulator,
            BiConsumer&lt;R,R&gt; combiner)
  </code></pre>
  
  <p>For this consider the following stream consisting on 100 random numbers</p>
  
  <pre><code>List&lt;Double&gt; dataList = new Random().doubles().limit(100).boxed()
              .collect(Collectors.toList());
  </code></pre>
  
  <p>1) Following example uses pure lambdas</p>
  
  <pre><code>Map&lt;Boolean, Integer&gt; partition = dataList.stream()
              .collect(() -&gt; new ConcurrentHashMap&lt;Boolean, Integer&gt;(),
  (map, x) -&gt;
  {
      map.merge(x &lt; 0.5 ? Boolean.TRUE : Boolean.FALSE, 1, Integer::sum);
  }, (map, map2) -&gt;
  {
      map2.putAll(map);
  });
  </code></pre>
  
  <p>2) Following tries to use method references but 2nd argument still requires a lambda</p>
  
  <pre><code>Map&lt;Boolean, Integer&gt; partition2 = dataList.stream()
              .collect(ConcurrentHashMap&lt;Boolean, Integer&gt;::new, 
  (map, x) -&gt;
  {
      map.merge(x &lt; 0.5 ? Boolean.TRUE : Boolean.FALSE, 1, Integer::sum);
  }, Map::putAll);
  </code></pre>
  
  <p>How can I rewrite 2nd argument of collect method in java 8 to use method reference instead of a lambda for this example?</p>
  
  <pre><code>System.out.println(partition.toString());
  System.out.println(partition2.toString());
  {false=55, true=45}
  {false=55, true=45}
  </code></pre>