title: How to count key values in a HashMap
body: <p>I basically am writing this for a game and i'm stuck..</p>
  
  <p>We basically have 2 teams</p>
  
  <pre><code>public enum TeamType {
     TEAM_ONE,
     TEAM_TWO;
  }
  
  private Optional&lt;TeamType&gt; team;
  </code></pre>
  
  <p>and a hashmap</p>
  
  <pre><code>private Map&lt;TeamType, Player&gt; teamPlayers = new HashMap&lt;&gt;();
  </code></pre>
  
  <p>how would we count the amount of players within a team type? 
  (Returning a numeric value) </p>
  
  <pre><code>teamPlayers.get(TeamType.ZAMORAK).size(); 
  </code></pre>
  
  <p>is not possible. </p>