Dedian  
-- 关注搜索引擎的开发
日历
<2006年6月>
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678
统计
  • 随笔 - 82
  • 文章 - 2
  • 评论 - 228
  • 引用 - 0

导航

常用链接

留言簿(8)

随笔分类(45)

随笔档案(82)

文章档案(2)

Java Spaces

搜索

  •  

积分与排名

  • 积分 - 64123
  • 排名 - 816

最新评论

阅读排行榜

评论排行榜

 
Unlike collection types such as Vector or List, Map (HashTable or HashMap) accesses a value by a key. If we want to retrieve all the values that have been put in a Map, one of simple ways to do that is employing a Collection or plus an Iterator, here is the sample code (just retrieve vaules, skip keys), assuming there is a variable: HashMap<String, <ComplexDataType>> links

Collection c = links.value();
Vector<ComplexDataType> v = new Vector<ComplexDataType>(c);
for(int i = 0; i< v.size(); i++)
{
    ComplexDataType tempData = (ComplexDataType)v.get(i);
    dosomethingwith(tempData);
}


P.S. Map provides three views of map: keySet, entrySet and values collection, we can use any of them .
posted on 2006-06-02 07:16 Dedian 阅读(328) 评论(0)  编辑  收藏 所属分类: Java Memo

只有注册用户登录后才能发表评论。


网站导航:
 
 
Copyright © Dedian Powered by: 博客园 模板提供:沪江博客