循环Map

public static void forMapTest(Map map){
    Iterator it=map.entrySet().iterator();
    while(it.hasNext()){
        Entry entry=(Entry) it.next();
        System.out.println("键="+entry.getKey()+" 值:"+entry.getValue());
    }
}

你可能感兴趣的:(java)