Override Equals for Hashmap<String,String>
问题 I have Hashmap,how to override equals method for the hashmap? Thanks. 回答1: if you want you can do: HashMap<String, String> map = new HashMap<String, String>(){ @Override public boolean equals(Object o) { // TODO comparison here return super.equals(o); } }; map.equals(new HashMap<String, String>()); 回答2: In HashMap already equals() method is overrriden.If you want to override object class equals() method eclipse shortcut key--->alt+shift+s+v Select the equals method click on ok. 回答3: You will