title: Custom Collector Implementation for summing float java 8
body: <p>I am trying to create a custom float addition similar to <code>Collectors.summingDouble()</code>.</p>
  
  <p>But I am facing 2 issues and I am not sure about how to fix it.</p>
  
  <ol>
  <li><code>BiConsumer</code> - Line #27 - void methods cannot return a value</li>
  <li><code>Collectors.of</code> - Line#32 - The method of(Supplier, <code>BiConsumer&lt;R,T&gt;</code>, <code>BinaryOperator&lt;R&gt;</code>, Collector.Characteristics...) in the type Collector is not applicable for the 
  arguments (<code>Supplier&lt;Float[]&gt;</code>, <code>BiConsumer&lt;Float,Employee&gt;</code>, <code>BinaryOperator&lt;Float&gt;</code>)
  What needs to be done here for fixing the issue?</li>
  </ol>
  
  <pre><code>public class CustomCollector {
  
  
      public static void main(String[] args) {
          Employee e1=new Employee(1,"Tom",10.2f);
          Employee e2=new Employee(1,"Jack",10.4f);
          Employee e3=new Employee(1,"Harry",10.4f);
          ArrayList&lt;Employee&gt; lstEmployee=new ArrayList&lt;Employee&gt;();
          lstEmployee.add(e1);lstEmployee.add(e2);lstEmployee.add(e3);
  
  /*  Implementation 1
   *  double totalSal=lstEmployee.stream().collect(Collectors.summingDouble(e-&gt;e.getSal()));
          System.out.println(totalSal);
  */  
          //Implementation 2
          Function&lt;Employee,Float&gt; fun=(e)-&gt;e.getSal();
          BiConsumer&lt;Float,Employee&gt; consumer=(val,e)-&gt;val+e.getSal();
          BinaryOperator&lt;Float&gt; operator=(val1,val2)-&gt;val1+val2;
          Supplier&lt;Float[]&gt; supplier=() -&gt; new Float[2];
  
          float FtotalSal=lstEmployee.stream().collect(
                  Collector.of(supplier,consumer,operator));
          System.out.println(FtotalSal);
      }
  
  }
  
  class Employee {
      int id;
      String name;
      float sal;
      // getters, setter, constructror
  }
  </code></pre>