java的Enumeration转list

 

java的Enumeration转list

Enumeration<String> attrs = getAttrNames();
// while(attrs.hasMoreElements()){
// String attrName = (String)attrs.nextElement();//调用nextElement方法获得元素
// dataMap.put(attrName, getAttr(attrName));
// }
ArrayList<String> a = Collections.list(attrs);
a.remove("i18nMap");//去除i18nMap
for(String attrName : a){
dataMap.put(attrName, getAttr(attrName));
}

posted on 2018-07-24 10:19  小甜瓜安东泥  阅读(1957)  评论(0编辑  收藏  举报