HashMap <String,String> hsMap=new HashMap<String,String> hsMap.put("1","value") Set<string> set=hsMap.keySet();//获取键值 Iterator <string> it=set.iterator(); while(it.hasNext()){ String str=it.next(); } Collection<String> coll=hsMap.values();//获取数值 Iterator <String> it2=coll.iterator(); while(it2.hasNext()){ String str=it2.next(); }
时间: 2024-10-09 20:59:35