Skip to content

Instantly share code, notes, and snippets.

@iyengarajay
Last active May 20, 2016 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iyengarajay/97c5f1e5406bc5a6106c2d0bbf602ce4 to your computer and use it in GitHub Desktop.
Save iyengarajay/97c5f1e5406bc5a6106c2d0bbf602ce4 to your computer and use it in GitHub Desktop.
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