title: Java 8 Stream: groupingBy with multiple Collectors
body: <p>I want to use a Java 8 Stream and Group by one classifier but have multiple Collector functions. So when grouping, for example the average and the sum of one field (or maybe another field) is calculated.</p>
  
  <p>I try to simplify this a bit with an example:</p>
  
  <pre><code>public void test() {
      List&lt;Person&gt; persons = new ArrayList&lt;&gt;();
      persons.add(new Person("Person One", 1, 18));
      persons.add(new Person("Person Two", 1, 20));
      persons.add(new Person("Person Three", 1, 30));
      persons.add(new Person("Person Four", 2, 30));
      persons.add(new Person("Person Five", 2, 29));
      persons.add(new Person("Person Six", 3, 18));
  
      Map&lt;Integer, Data&gt; result = persons.stream().collect(
              groupingBy(person -&gt; person.group, multiCollector)
      );
  }
  
  class Person {
      String name;
      int group;
      int age;
  
      // Contructor, getter and setter
  }
  
  class Data {
      long average;
      long sum;
  
      public Data(long average, long sum) {
          this.average = average;
          this.sum = sum;
      }
  
      // Getter and setter
  }
  </code></pre>
  
  <p>The result should be a Map that associates the result of grouping like</p>
  
  <pre><code>1 =&gt; Data(average(18, 20, 30), sum(18, 20, 30))
  2 =&gt; Data(average(30, 29), sum(30, 29))
  3 =&gt; ....
  </code></pre>
  
  <p>This works perfectly fine with one function like "Collectors.counting()" but I like to chain more than one (ideally infinite from a List).</p>
  
  <pre><code>List&lt;Collector&lt;Person, ?, ?&gt;&gt;
  </code></pre>
  
  <p>Is it possible to do something like this?</p>