Skip to content

Instantly share code, notes, and snippets.

@iyengarajay
Last active May 7, 2017 09:44
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/bc3a7f2da35e993eacf7e9036d92664a to your computer and use it in GitHub Desktop.
Save iyengarajay/bc3a7f2da35e993eacf7e9036d92664a to your computer and use it in GitHub Desktop.
private static void removeIllegalUsingIterator()
{
Iterator<Person> personIterator = persons.iterator();
while (personIterator.hasNext())
{
if (personIterator.next().getAge() < 18)
{
personIterator.remove();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment