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));
}
05-13 23:06