/** * Creates a new <code>THashMap</code> instance which contains the * key/value pairs in <tt>map</tt>. * * @param map a <code>Map</code> value */ public THashMap(THashMap<? extends K, ? extends V> map) { this(map.size()); putAll(map); }
public void clear() { THashMap.this.clear(); }
/** * Compares this map with another map for equality of their stored * entries. * * @param other an <code>Object</code> value * @return a <code>boolean</code> value */ @SuppressWarnings({"unchecked", "SimplifiableIfStatement"}) public boolean equals(Object other) { if (!(other instanceof Map)) { return false; } Map<K, V> that = (Map<K, V>) other; if (that.size() != this.size()) { return false; } return forEachEntry(new EqProcedure<K, V>(that)); }
@Override public int size() { return delegate.size(); }
@Override public int size() { return delegate.size(); }
/** * Creates a new <code>THashMap</code> instance which contains the * key/value pairs in <tt>map</tt>. * * @param map a <code>Map</code> value */ public THashMap(THashMap<? extends K, ? extends V> map) { this(map.size()); putAll(map); }
/** * Creates a new <code>THashMap</code> instance which contains the * key/value pairs in <tt>map</tt>. * * @param map a <code>Map</code> value */ public THashMap(THashMap<? extends K, ? extends V> map) { this(map.size()); putAll(map); }
/** * Creates a new <code>THashMap</code> instance which contains the * key/value pairs in <tt>map</tt>. * * @param map a <code>Map</code> value */ public THashMap( THashMap<K, V> map ) { this( map.size() ); putAll( map ); }
/** * Creates a new <code>THashMap</code> instance which contains the * key/value pairs in <tt>map</tt>. * * @param map a <code>Map</code> value */ public THashMap(THashMap<? extends K, ? extends V> map) { this(map.size()); putAll(map); }
public void clear() { THashMap.this.clear(); }
@Override public void clear() { THashMap.this.clear(); }
public void clear() { THashMap.this.clear(); }
public void clear() { THashMap.this.clear(); }
/** * rehashes the map to the new capacity. * * @param newCapacity an <code>int</code> value */ @Override @SuppressWarnings({"unchecked"}) protected void rehash(int newCapacity) { int oldCapacity = _set.length; int oldSize = size(); Object oldKeys[] = _set; V oldVals[] = _values; _set = new Object[newCapacity]; Arrays.fill(_set, FREE); _values = (V[]) new Object[newCapacity]; // Process entries from the old array, skipping free and removed slots. Put the // values into the appropriate place in the new array. for (int i = oldCapacity; i-- > 0;) { Object o = oldKeys[i]; if (o == FREE || o == REMOVED) continue; int index = insertKey((K) o); if (index < 0) { throwObjectContractViolation(_set[(-index - 1)], o, size(), oldSize, oldKeys); } _values[index] = oldVals[i]; } // Last check: size before and after should be the same reportPotentialConcurrentMod(size(), oldSize); }
/** * Compares this map with another map for equality of their stored * entries. * * @param other an <code>Object</code> value * @return a <code>boolean</code> value */ @SuppressWarnings({"unchecked", "SimplifiableIfStatement"}) public boolean equals(Object other) { if (!(other instanceof Map)) { return false; } Map<K, V> that = (Map<K, V>) other; if (that.size() != this.size()) { return false; } return forEachEntry(new EqProcedure<K, V>(that)); }
/** * Compares this map with another map for equality of their stored * entries. * * @param other an <code>Object</code> value * @return a <code>boolean</code> value */ @SuppressWarnings({"unchecked", "SimplifiableIfStatement"}) public boolean equals(Object other) { if (!(other instanceof Map)) { return false; } Map<K, V> that = (Map<K, V>) other; if (that.size() != this.size()) { return false; } return forEachEntry(new EqProcedure<K, V>(that)); }
/** * Compares this map with another map for equality of their stored * entries. * * @param other an <code>Object</code> value * @return a <code>boolean</code> value */ @Override @SuppressWarnings({"unchecked"}) public boolean equals(Object other) { if (!(other instanceof Map)) { return false; } Map<K, V> that = (Map<K, V>) other; if (that.size() != this.size()) { return false; } return forEachEntry(new EqProcedure(that)); }
/** * Compares this map with another map for equality of their stored * entries. * * @param other an <code>Object</code> value * @return a <code>boolean</code> value */ @SuppressWarnings({"unchecked", "SimplifiableIfStatement"}) public boolean equals( Object other ) { if ( !( other instanceof Map ) ) { return false; } Map<K, V> that = (Map<K, V>) other; if ( that.size() != this.size() ) { return false; } return forEachEntry( new EqProcedure<K, V>( that ) ); }