java Map集合学习
学习语法还是从例子着手:
FileDao fileDao=new FileBeanDaoImpl();
FileBean fileBean=new FileBean();
listBean=fileDao.getAll();
Map<Integer,FileBean> tree=new HashMap<Integer,FileBean>();
for(int i=0;i<listBean.size();i++){
Integer integer=listBean.get(i).getId();
tree.put(integer, listBean.get(i));
}
Set set=tree.entrySet();
Iterator<Entry<Integer, FileBean>> it=tree.entrySet().iterator();
while(it.hasNext()){
Map.Entry<Integer, FileBean> mapSet=it.next();
mapSet.getKey();
mapSet.getValue();
}
详细请看百度文库的这篇文章:
http://wenku.baidu.com/link?url=fwEBBjBqv6GcMy1Rz6paaj4U9AOo2paorXdtiIoS6wzS1ojRaZT9asUI3CfUwgj8iLoKk2plnnv-96hoLFWFxdecmwgYFsjEpo0HW9mOySC