Skip to content

Instantly share code, notes, and snippets.

@jaydenlin
Created December 21, 2013 02:24
Show Gist options
  • Save jaydenlin/8064653 to your computer and use it in GitHub Desktop.
Save jaydenlin/8064653 to your computer and use it in GitHub Desktop.
iterator in java
public static void foreach(Collection<String> collection) {
Iterator<String> iterator = collection.iterator();
while(iterator.hasNext()) {
System.out.println(iterator.next());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment