@Test public void caseInsenstiveMapWithDifferentSizeHaveDifferentHashCode() { final CaseInsensitiveMap<String> one=defaultMap(); final CaseInsensitiveMap<String> other=subMap(); assertThat(one.hashCode(),not(equalTo(other.hashCode()))); }
@Override public int hashCode() { int hash=19*this.locale.hashCode(); for(Entry<String,V> entry:super.entrySet()) { hash*=convertKey(entry.getKey()).hashCode()^entry.getValue().hashCode(); } return hash; }
CaseInsensitiveMap extends ForwardingMap<String, V> { @Override public int hashCode() { int hash=19*this.locale.hashCode(); for(Entry<String,V> entry:super.entrySet()) { hash*=convertKey(entry.getKey()).hashCode()^entry.getValue().hashCode(); } return hash; } }
CaseInsensitiveMap extends ForwardingMap<String, V> { @Override public int hashCode() { int hash=19*this.locale.hashCode(); for(Entry<String,V> entry:super.entrySet()) { hash*=convertKey(entry.getKey()).hashCode()^entry.getValue().hashCode(); } return hash; } private  CaseInsensitiveMap(final LinkedHashMap<String,V> delegate, final Map<String,String> caseInsensitiveKeys, final Locale locale);   CaseInsensitiveMap();   CaseInsensitiveMap(final int initialCapacity);   CaseInsensitiveMap(final Locale locale);   CaseInsensitiveMap(final int initialCapacity, final Locale locale); }
CaseInsensitiveMap extends ForwardingMap<String, V> { @Override public int hashCode() { int hash=19*this.locale.hashCode(); for(Entry<String,V> entry:super.entrySet()) { hash*=convertKey(entry.getKey()).hashCode()^entry.getValue().hashCode(); } return hash; } private  CaseInsensitiveMap(final LinkedHashMap<String,V> delegate, final Map<String,String> caseInsensitiveKeys, final Locale locale);   CaseInsensitiveMap();   CaseInsensitiveMap(final int initialCapacity);   CaseInsensitiveMap(final Locale locale);   CaseInsensitiveMap(final int initialCapacity, final Locale locale); @Override V put(final String key, final V value); @Override void putAll(final Map<? extends String, ? extends V> map); @Override boolean containsKey(final Object key); @Override V get(final Object key); @Override V remove(final Object key); @Override void clear(); @Override int hashCode(); @Override boolean equals(final Object other); }
CaseInsensitiveMap extends ForwardingMap<String, V> { @Override public int hashCode() { int hash=19*this.locale.hashCode(); for(Entry<String,V> entry:super.entrySet()) { hash*=convertKey(entry.getKey()).hashCode()^entry.getValue().hashCode(); } return hash; } private  CaseInsensitiveMap(final LinkedHashMap<String,V> delegate, final Map<String,String> caseInsensitiveKeys, final Locale locale);   CaseInsensitiveMap();   CaseInsensitiveMap(final int initialCapacity);   CaseInsensitiveMap(final Locale locale);   CaseInsensitiveMap(final int initialCapacity, final Locale locale); @Override V put(final String key, final V value); @Override void putAll(final Map<? extends String, ? extends V> map); @Override boolean containsKey(final Object key); @Override V get(final Object key); @Override V remove(final Object key); @Override void clear(); @Override int hashCode(); @Override boolean equals(final Object other);  }