迭代器就是遍历集合里的元素
public static Map<String, Object> mpa = new HashMap<String, Object>();
public PropertyBeanFactory(){
Properties pro = new Properties(); //集合
try {
pro.load(this.getClass().getClassLoader().getResourceAsStream("dao.properties"));
Set<Entry<Object, Object>> set = pro.entrySet();
Iterator<Entry<Object, Object>> its = set.iterator();
while(its.hasNext()){
Entry<Object, Object> i = its.next();
String key = (String) i.getKey();
String value = (String) i.getValue();
Object o = Class.forName(value).newInstance();
mpa.put(key, o);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}