Skip to content

Instantly share code, notes, and snippets.

@iyengarajay
Last active May 20, 2016 13:01
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/02597cd04152ac2d5c2b4fd029bd0536 to your computer and use it in GitHub Desktop.
Save iyengarajay/02597cd04152ac2d5c2b4fd029bd0536 to your computer and use it in GitHub Desktop.
Version1: Get list of all men from a list of Person Objects
private static List<Person> getAllMen(List<Person> persons)
{
List<Person> men = new ArrayList<>();
for(Person person : persons)
{
if(person.getGender() == Gender.MALE)
{
men.add(person);
}
}
return men;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment