title: Generic method to perform a map-reduce operation. (Java-8)
body: <p>How to overload a Function with generic parameter in Java 8?</p>
  
  <pre><code>public class Test&lt;T&gt; {
  
      List&lt;T&gt; list = new ArrayList&lt;&gt;();
  
      public int sum(Function&lt;T, Integer&gt; function) {
          return list.stream().map(function).reduce(Integer::sum).get();
      }
  
  
      public double sum(Function&lt;T, Double&gt; function) {
          return list.stream().map(function).reduce(Double::sum).get();
      }
  }
  </code></pre>
  
  <blockquote>
    <p>Error: java: name clash: 
    sum(java.util.function.Function&lt;T,java.lang.Double&gt;) and 
    sum(java.util.function.Function&lt;T,java.lang.Integer&gt;) have the same erasure</p>
  </blockquote>