关于linkedList的一个问题

yangbailao 2005-05-09 09:20:47
List storeList=new LinkedList();
Hashtable storeMonth=new Hashtable();
storeMonth.put("one",new Integer(1));
storeList.add(storeMonth);

storeMonth=new Hashtable();
storeMonth.put("two",new Integer(2));
storeList.add(storeMonth);

storeMonth=new Hashtable();
storeMonth.put("may",new Integer(5));
storeList.add(storeMonth);

storeMonth=new Hashtable();
storeMonth.put("july",new Integer(7));
storeList.add(storeMonth);
我如何把这个linkedList中的hashtable中的内容全部取出来????
...全文
73 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
MARS.nEIL 2005-05-09
  • 打赏
  • 举报
回复
while(it.hasNext()){
MARS.nEIL 2005-05-09
  • 打赏
  • 举报
回复
get(int)
yangbailao 2005-05-09
  • 打赏
  • 举报
回复
Iterator it=storeList.iterator();
if(it.hasNext()){
Hashtable receiveMonth=(Hashtable)it.next();
Enumeration e=receiveMonth.keys();
while(e.hasMoreElements())
{
Object key=e.nextElement();
out.print(receiveMonth.get(key).toString());
}
}
我是这样迭代的、但只取出了第一个element。
Net8Java 2005-05-09
  • 打赏
  • 举报
回复
你迭代这个list嘛
然后在里面把map取出来,得到他的所有键,然后取值不就行了嘛

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧