相关文章推荐
爱看书的签字笔  ·  Single ...·  1 月前    · 
好帅的铅笔  ·  postgresql - PHP ...·  1 年前    · 
谦虚好学的柚子  ·  编程大讲堂 - 知乎·  2 年前    · 
   public static void main(String[] args) {
        Map<String, Object> hashMap = new HashMap<>();
        hashMap.put("a","1");
        hashMap.put("b",null);
        hashMap.put("c","3");
        for(Map.Entry<String, Object> moEntry : hashMap.entrySet()){
            try {
                boolean equals = moEntry.getValue().equals("1");
                System.out.println(moEntry.getKey() + "," + moEntry.getValue() +","+  equals);
            } catch (Exception e) {
                e.printStackTrace();
                System.out.println("异常");
                continue; //加上continue 出现异常后会执行后面的操作,打印11 ,若不加continue则不会打印11,直接进行下一个循环
            System.out.println("11");