Printing HashMap In Java

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

I have a HashMap:

private HashMap example = new HashMap();

Now I would lik

15条回答
  •  盖世英雄少女心
    2020-11-28 19:53

    I did it using String map (if you're working with String Map).

    for (Object obj : dados.entrySet()) {
        Map.Entry entry = (Map.Entry) obj;
        System.out.print("Key: " + entry.getKey());
        System.out.println(", Value: " + entry.getValue());
    }
    

提交回复
热议问题