Printing HashMap In Java

后端 未结 15 1732
半阙折子戏
半阙折子戏 2020-11-28 19:32

I have a HashMap:

private HashMap example = new HashMap();

Now I would lik

15条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 19:46

    You have several options

    • Get map.values() , which gets the values, not the keys
    • Get the map.entrySet() which has both
    • Get the keySet() and for each key call map.get(key)

提交回复
热议问题