Skip to content

Instantly share code, notes, and snippets.

@sue445
Created June 19, 2012 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sue445/2953530 to your computer and use it in GitHub Desktop.
Save sue445/2953530 to your computer and use it in GitHub Desktop.
Map entry sample
import java.util.HashMap;
import java.util.Map;
public class MapSample {
public static void main(String[] args) {
Map<String, Integer> map = new HashMap<String, Integer>();
map.put("a", 1);
map.put("b", 2);
map.put("c", 3);
for(Map.Entry<String, Integer> entry : map.entrySet()){
System.out.println("key=" + entry.getKey() + ", value=" + entry.getValue());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment