Created
December 21, 2013 02:24
-
-
Save jaydenlin/8064653 to your computer and use it in GitHub Desktop.
iterator in java
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
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