Printing HashMap In Java

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

I have a HashMap:

private HashMap example = new HashMap();

Now I would lik

15条回答
  •  無奈伤痛
    2020-11-28 19:56

    You can use Entry class to read HashMap easily.

    for(Map.Entry temp : example.entrySet()){
        System.out.println(temp.getValue()); // Or something as per temp defination. can be used
    }
    

提交回复
热议问题