list map中的value获取

来源:互联网 发布:淘宝网店模板制作教程 编辑:程序博客网 时间:2024/05/18 17:27
//list中的数据可以用iterate获取,也可以循环,但是map values中的只能用iterate collection
Map map = new HashMap<Integer, String>(); 
map.put(1, "frist"); 
map.put(2, "second"); 
Collection con = map.values();   
Iterator ite = con.iterator();       
while(ite.hasNext()) { 
    System.out.println(ite.next()); 

0 0
原创粉丝点击