Foreach loop in java for Dictionary

后端 未结 4 1062
死守一世寂寞
死守一世寂寞 2021-02-19 20:15

I want to go through every items in a dictionary in java. to clarify what I want to do, this is the C# code

Dictionary LableList = new Dict         


        
4条回答
  •  忘掉有多难
    2021-02-19 20:33

    java.util.Map is the Dictionary equvivalent and below is an example on how you can iterate through each entry

    for(Map.Entry e : map.entrySet())
    {
        System.out.println(e.getKey()+": "+e.getValue());
    }
    

提交回复
热议问题