title: How to sum values of a map that inside another map in java?
body: <p>I have this map that has another HashMap inside it. How can I sum the values of the inner maps and compare them ?</p>
  
  <p>Also the maps size changeable. So I'm looking for a solution that works every size of the maps.</p>
  
  <pre><code>{Team2={Alex=0, Tom=20}, Team1={John=0, Ammy=9, Monica=1}, Team3{...}, ...}
  </code></pre>
  
  <p>values of teams --> {Alex=0, Tom=20},   {John=0, Ammy=9, Monica=1} ...</p>
  
  <p>values of these values is --> {0,20},   {0,9,1}...</p>
  
  <p>I just want to sum this values and find the biggest one.</p>
  
  <pre><code> for(int i = 0 ; i &lt; teamNameList.size() ; i++){
                  int sum = sum + teams.get(teamNameList.get(i)).values().values();
              }
  </code></pre>