Map<String,Integer> map1 = new HashMap<>(); map1.put("1", 1); Map<String, Integer> map2 = new HashMap<>(); map2.put("1",1); System.out.print(map1.equals(map2));
打印结果:true;
map.equals()方法能判断两个map的元素内容是否完全相等。
Map<String,Integer> map1 = new HashMap<>(); map1.put("1", 1); Map<String, Integer> map2 = new HashMap<>(); map2.put("1",1); System.out.print(map1.equals(map2));
打印结果:true;
map.equals()方法能判断两个map的元素内容是否完全相等。