Map类型
来源:互联网 发布:在手机淘宝上开店步骤 编辑:程序博客网 时间:2024/04/29 01:57
import java.util.HashMap;import java.util.Iterator;import java.util.Map;import java.util.Set;public class MapExample {public static void main(String[] args) {Map<Object, String> mp = new HashMap<Object, String>();// adding or set elements in Map by put method key and value pairmp.put(new Integer(2), "Two");mp.put(new Integer(1), "One");mp.put(new Integer(3), "Three");mp.put(new Integer(4), "Four");// Get Map in Set interface to get key and valueSet s = mp.entrySet();// Move next key and value of Map by iteratorIterator it = s.iterator();while (it.hasNext()) {// key=value separator this by Map.Entry to get key and valueMap.Entry m = (Map.Entry) it.next();// getKey is used to get key of Mapint key = (Integer) m.getKey();// getValue is used to get value of key in MapString value = (String) m.getValue();System.out.println("Key :" + key + " Value :" + value);}}}
原文:http://www.easywayserver.com/blog/java-map-example/
参考:http://188029.net/java/j12-06-16.html
- Map类型
- MAP类型
- c++ map 类型用法
- Map判断值类型
- 20110405-map类型
- pair类型 map
- C++ MAP类型
- Google map 地图类型
- map的类型映射
- map/multimap容器类型
- Flex做成Map类型
- scala Map类型笔记
- STL的map类型
- js map类型实现
- 2.7map容器类型
- freemarker遍历Map类型
- [golang]map/set类型
- 备份map类型
- NEFU 663 Emergency 最短路 floyd
- ZZ买衣服 STL
- 2KB内存单片机上实现彩屏GUI控件库
- Android开发中的drawable-(hdpi,mdpi,ldpi)和WVGA,HVGA,QVGA的区别以及联系
- 黑马第二天总结
- Map类型
- overflow:hidden line
- 海康 网络摄像头 多摄像头数据传输及流解码
- SecureCRT 显示中文的方法
- Codeforces 300 C Beautiful Numbers (Locas)
- head 方法比对讲解
- Qt教程一 —— 共十四步
- 工厂方法(Factory Method)之追根究底
- cocos2d实现画笔功能及常用的绘制函数