title: Get average value entry from Map
body: <p>I am trying to get the average value from a Map using Java 8, but instead of getting the value itself I want to get the Map.Entry.</p>
  
  <pre><code>double average = totals.entrySet()
                         .stream()
                         .mapToDouble(i -&gt; i.getValue())
                         .average()
                         .orElse(0); //Want to get Map.Entry instead
  </code></pre>