title: Collection<Integer> cannot be converted to int while using Stream API
body: <p>I want to do a <code>Map&lt;Person, Double&gt;</code>, where <code>Double</code> is average of <code>Integer</code> values that is stored in another <code>Map &lt;String, Integer&gt;</code> which is one of the fields of stream's elements.</p>
  <pre class="lang-java prettyprint-override"><code>public Map&lt;Person,Double&gt; totalScores(Stream&lt;CourseResult&gt; programmingResults) {
      return 
          programmingResults.collect(Collectors.groupingBy(
              CourseResult::getPerson,
  // And there is a problem, I want to get values from `Map &lt;String, Integer&gt;` 
  // and do the `averagingInt`, but only get 
  //`Bad return type in lambda expression: 
  // Collection&lt;Integer&gt; cannot be converted to int`
  
              Collectors.averagingInt(
                  s -&gt; s.getTaskResults().values()
              )
          ));
  }
  </code></pre>
  <p>How can I get these values in the right way?</p>
  <p>There's some of the classes I'm using:</p>
  <pre class="lang-java prettyprint-override"><code>public class CourseResult {
      private final Person person;
      private final Map&lt;String, Integer&gt; taskResults;
      
      public CourseResult(final Person person, final Map&lt;String, Integer&gt; taskResults) {
          this.person = person;
          this.taskResults = taskResults;
      }
      
      public Person getPerson() {
          return person;
      }
      
      public Map&lt;String, Integer&gt; getTaskResults() {
          return taskResults;
      }
  }
  </code></pre>