title: How to use collect method with three params i.e "collect(supplier, accumulator, combiner)" to add integers in a list
body: <p>Being a beginner to java functional programming, I need some help on <code>collect()</code> that takes into consideration the three params i.e <code>list.parallelStream().collect(supplier, accumulator, combiner)</code>. How can i calculate sum of salary all employees mentioned in the list.</p>
  <pre><code>public class SumMethodsOfCollectorclass {
      public static void main(String[] args) {
        List&lt;Employee&gt; list = new ArrayList&lt;&gt;();
        list.add(new Employee(6, &quot;Nick&quot;, 27, &quot;Software Engineer&quot;, 44000f));
        list.add(new Employee(9, &quot;Tom&quot;, 23, &quot;Civil Engineer&quot;, 32000f));
        list.add(new Employee(3, &quot;Jon&quot;, 29, &quot;Mechanical Engineer&quot;, 37000f));
        list.add(new Employee(4, &quot;Harry&quot;, 21, &quot;Surgeon&quot;, 55000f));
        list.add(new Employee(8, &quot;Don&quot;, 25, &quot;Laywer&quot;, 50000f));
        list.add(new Employee(7, &quot;Marry&quot;, 20, &quot;Police&quot;, 29000f));
        list.add(new Employee(2, &quot;Angel&quot;, 22, &quot;Professor&quot;, 35000f));
        list.add(new Employee(1, &quot;Kate&quot;, 23, &quot;Teacher&quot;, 29000f));
        list.add(new Employee(5, &quot;Evan&quot;, 22, &quot;Pilot&quot;, 44000f));
  
        sumOfAgeOfAllEmployees(list);
        sumOfSalaryOfAllEmployees(list);
      }
  
      private static void sumOfAgeOfAllEmployees(List&lt;Employee&gt; list) {
        Integer result = list.stream().parallel().collect(Collectors.summingInt(i -&gt; i.getAge()));
        System.out.println(&quot;The sum of age of all employees - &quot; + result);
      }
  
      private static void sumOfSalaryOfAllEmployees(List&lt;Employee&gt; list) {
        // to get the sum of salary of all the employees
        list.parallelStream().collect(supplier, accumulator, combiner)
      }
  }
  </code></pre>