hashtable遍历

Hashtable ht;

//取key,值
for(Iterator it = ht.keySet().itrator();it.hasNext();)
{
	String key = (String)it.next();
	ObjectA value = (ObjectA)ht.get(key);
}

//取key,值
Enumeration enm = ht.keys();
while(enm.hasMoreElements())
{
	String key = (String)enm.nextElement();
	ObjectA value = (ObjectA)ht.get(key);
}

//取值
Enumeration enm = ht.elements();
while(enm.hasMoreElements())
{
	ObjectA value = (ObjectA)enm.nextElement();
}

原文地址:https://www.cnblogs.com/nafio/p/9137728.html