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();
}

posted @ 2013-10-31 12:07  00000000O  阅读(157)  评论(0编辑  收藏  举报