熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java核心技術 >> 正文

Map的一種遍歷方式

2022-06-13   來源: Java核心技術 
    在實際開發中自己常運用到Map集合在開發中自己運用到
   
    Map<StringString> map=new HashMap<StringString>()
   
    遍歷
   
    Java代碼
   
    Set<String> key = mapkeySet()
   
                    Iterator<String> it = erator()
   
                    while (ithasNext()) {
   
                        String keyV = (String) itnext()
   
                        String vb =  mapget(keyV)
   
                        if (keyVequals(dd)) {
   
                            itemjin = vb;
   
                            break;
   
                        }
   
                    }
   
    Set<String> key = mapkeySet()
   
    Iterator<String> it = erator()
   
    while (ithasNext()) {
   
    String keyV = (String) itnext()
   
    String vb =  mapget(keyV)
   
    if (keyVequals(dd)) {
   
    itemjin = vb;
   
    break;
   
    }
   
    }
From:http://tw.wingwit.com/Article/program/Java/hx/201311/26537.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.