-
-
Save iyengarajay/bc3a7f2da35e993eacf7e9036d92664a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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