Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private static List<String> displayAllTeamNamesImperative(List<League> leagues){
List<String> teamNames = new ArrayList<>();
for(League league : leagues)
{
List<Team> teams = league.getTeams();
for(Team team : teams)
{
teamNames.add(team.getName());
}
}
return teamNames;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment