If this was a list of players:
private Map<TeamType, List<Player>> teamPlayers = new HashMap<>();
This will work:
teamPlayers.get(TeamType.TEAM_ONE).size();
Of course, you will need to initialize an empty list of players:
teamPlayers.put(TeamType.TEAM_ONE, new ArrayList<Player>());
teamPlayers.put(TeamType.TEAM_TWO, new ArrayList<Player>());
Then add players to the team:
teamPlayers.get(TeamType.TEAM_ONE).add(new Player());
source
share