//获取key值
Enumeration k = lovResults.keys();
while(k.hasMoreElements()){
System.out.println(k.nextElement());
}
//获取VALUE值
Enumeration e = lovResults.elements();
while(e.hasMoreElements()){
System.out.println(e.nextElement());
}
方式一:
Map<Integer, Integer> map = new HashMap<Integer, Integer>(); for (Map.Entry<Integer, Integer> entry : map.entrySet()) { System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue()); }
方式二:
StringBuffer sbuffer = new StringBuffer(600); for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) { Map.Entry element = (Map.Entry) iter.next(); String strKey = (String) element.getKey(); String strValue = element.getValue() != null? element.getValue().toString(): null; // System.out.println(" strKey -->"+strKey+" strValue-->"+strValue); sbuffer.append(strKey+":"+strValue+"; "); }