Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public List<String> getNamesOfUKCitizens(List<Person> persons)
{
List<String> allUKCitizens = new ArrayList<>();
for(Person p : persons)
{
if(p.getCitizenship() == Citizenship.UK){
allUKCitizens.add(p.getName());
}
}
return allUKCitizens;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment