DefaultMapEntry implements Map.Entry<K, V> { @Override public boolean equals(Object o) { if (o == null) { return false; } if (o == this) { return true; } if (!(o instanceof Map.Entry)) { return false; } Map.Entry<?, ?> e = (Map.Entry<?, ?>) o; return ObjectUtil.isEquals(key, e.getKey()) && ObjectUtil.isEquals(value, e.getValue()); } DefaultMapEntry(K key, V value); K getKey(); V getValue(); V setValue(V value); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void equals_() { DefaultMapEntry<String, Object> e1 = new DefaultMapEntry<String, Object>(null, null); DefaultMapEntry<String, Object> e2 = new DefaultMapEntry<String, Object>("hello", "baobao"); assertTrue(e1.equals(entry1)); assertTrue(e2.equals(entry2)); assertTrue(e1.equals(e1)); assertFalse(e1.equals(null)); assertFalse(e1.equals("")); }