Map.Entry是个子接口主要有getKey和getValue方法HashMap hm = new HashMap();
hm.put("Tom","Tom's value");
hm.put("Cat","Cat's value");
Set set = hm.entrySet();
Iterator it = set.iterator();
while(it.hasNext()){
Map.Entry me = (Map.Entry)it.next();
out.println(me.getKey());
out.println(me.getValue());
}iterator对象一般无法更改
hm.put("Tom","Tom's value");
hm.put("Cat","Cat's value");
Set set = hm.entrySet();
Iterator it = set.iterator();
while(it.hasNext()){
Map.Entry me = (Map.Entry)it.next();
out.println(me.getKey());
out.println(me.getValue());
}iterator对象一般无法更改
解决方案 »
- java 规律数组 查找出 每个索引间的 缺失的值
- 大学生想到大公司,需要学j2EE吗?还是只是学c语言或c++语言
- hibernate单向和双向关联问题
- 关于OSGI web应用的一个小问题
- weblogic 启动后异常,help!!!
- @@@ com.ibatis.struts.BeanActionException 这个异常是因为什么?
- 紧急求助!solars9需要安装mysql+tomcat+apache,求高手帮忙安装,有重谢
- 除了做网页,JAVA到底有什么用。困惑呀。帮忙解惑吧
- session bean问题
- 列表页没有数据,急!!!
- ####一个J2EE功能分布问题,请高手指点#####
- JavaBean 能返回一个ResultSet 吗? (高手进,在线等)
Map.Entry有个setValue(Object value) 方法,如果用这个方法更新value值,会不会影响Hashtable中的值?
更改Hashtable中的值只用对Map.Entry中的value有影响吗?
他们是否是同步的?