1、新建一個HashMap
Map<Integer , String> notProcInfo = new HashMap<Integer , String>();
2、往HashMap中增添數據
notProcInfo.put(infoId, infoTitle);//infoId為int型,infoTitle為String型
3、遍歷HashMap
Iterator<Entry<Integer, String>> iter = notProcInfo.entrySet().iterator(); while(iter.hasNext()){ Map.Entry<Integer, String> info= iter.next(); int key = info.getKey();//獲取健 String content = info.getValue();//獲取值 }