MapEntry implements Map.Entry<K, V> { @Override public int hashCode() { return (this.getKey() == null ? 0 : this.getKey().hashCode()) ^ (this.getValue() == null ? 0 : this.getValue().hashCode()); } MapEntry(K key, V value, boolean modifiable); K getKey(); V getValue(); V setValue(V val); @Override @SuppressWarnings("unchecked") boolean equals(Object o); @Override int hashCode();  }
@Test public void testHashCode() { MapEntry<String, String> entry = new MapEntry<String, String>("key", "value", false); assertEquals("key".hashCode() ^ "value".hashCode(), entry.hashCode()); entry = new MapEntry<String, String>(null, "value", false); assertEquals(0 ^ "value".hashCode(), entry.hashCode()); entry = new MapEntry<String, String>("key", null, false); assertEquals("key".hashCode() ^ 0, entry.hashCode()); entry = new MapEntry<String, String>(null, null, false); assertEquals(0 ^ 0, entry.hashCode()); }