Created
January 29, 2013 15:53
-
-
Save mchirico/4665270 to your computer and use it in GitHub Desktop.
Example iterator with HashMap
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 void pr(ConcurrentHashMap<String, String[][]> hmap) { | |
Iterator itr = hmap.entrySet().iterator(); | |
while (itr.hasNext()) { | |
Map.Entry pairs = (Map.Entry) itr.next(); | |
System.out.println("key= " + pairs.getKey()); | |
pr((String[][]) pairs.getValue()); | |
// itr.remove(); // avoids a ConcurrentModificationException | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment