title: Calculate average of values in hashmap
body: <p>I am creating a application for calculating average marks of male and female students in a class</p>
  
  <pre><code> Name class marks gender
    abc   1    20    M
    REF   1    30    F
    def   2    30    F
    xyz   1    40    M
    dsf   3    20    F
    wer   2    10    F
  </code></pre>
  
  <p>I want the final output to be as</p>
  
  <pre><code>   class gender  average
      1     M       30 
      1     F       30
      2     F       20
  </code></pre>
  
  <p>i.e class with male and female with thier average</p>
  
  <p>I have created a map with values as input </p>
  
  <p>Key as class and values as the complete student object</p>
  
  <p>Which is better approach
  To create two separate maps for female and male
  Calculate average and then separately</p>
  
  <p>With only single map</p>