HashMap hm = new HashMap();
hm.put("a", 1);
hm.put("b", 2);
hm.put("c", 3);
Set set = new HashSet();
set = hm.keySet();
Iterator it = set.iterator();
String s;
while (it.hasNext()) {
s = it.next().toString();
System.out.println( s + " = " + hm.get(s).toString());
}
沒有留言:
張貼留言