Created
August 16, 2012 14:17
-
-
Save anderson-martins/3370404 to your computer and use it in GitHub Desktop.
Iteration over HashTable
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
Map<Integer, String> map = ... | |
Iterator<Map.Entry<Integer, String>> it = map.entrySet().iterator(); | |
while (it.hasNext()) { | |
Map.Entry<Integer, String> entry = it.next(); | |
// Remove entry if key is null or equals 0. | |
if (entry.getKey() == null || entry.getKey() == 0) { | |
it.remove(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment