/** * Creates a new <code>TCustomHashMap</code> instance which contains the * key/value pairs in <tt>map</tt>. * * @param map a <code>Map</code> value */ public TCustomHashMap( HashingStrategy<? super K> strategy, TCustomHashMap<? extends K, ? extends V> map ) { this( strategy, map.size() ); putAll( map ); }
public void clear() { TCustomHashMap.this.clear(); }
/** * rehashes the map to the new capacity. * * @param newCapacity an <code>int</code> value */ @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 ]; } }
/** * 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 ) ); }
/** * Creates a new <code>TCustomHashMap</code> instance which contains the * key/value pairs in <tt>map</tt>. * * @param map a <code>Map</code> value */ public TCustomHashMap( HashingStrategy<? super K> strategy, TCustomHashMap<? extends K, ? extends V> map ) { this( strategy, map.size() ); putAll( map ); }
/** * Creates a new <code>TCustomHashMap</code> instance which contains the * key/value pairs in <tt>map</tt>. * * @param map a <code>Map</code> value */ public TCustomHashMap( HashingStrategy<? super K> strategy, TCustomHashMap<? extends K, ? extends V> map ) { this( strategy, map.size() ); putAll( map ); }
/** * Creates a new <code>TCustomHashMap</code> instance which contains the * key/value pairs in <tt>map</tt>. * * @param map a <code>Map</code> value */ public TCustomHashMap( HashingStrategy<? super K> strategy, TCustomHashMap<? extends K, ? extends V> map ) { this( strategy, map.size() ); putAll( map ); }
/** * Creates a new <code>TCustomHashMap</code> instance which contains the * key/value pairs in <tt>map</tt>. * * @param map a <code>Map</code> value */ public TCustomHashMap( HashingStrategy<K> strategy, TCustomHashMap<K, V> map ) { this( strategy, map.size() ); putAll( map ); }
/** * rehashes the map to the new capacity. * * @param newCapacity an <code>int</code> value */ @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 ]; } }
@Override public void clear() { TCustomHashMap.this.clear(); }
/** * rehashes the map to the new capacity. * * @param newCapacity an <code>int</code> value */ @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 ]; } }
public void clear() { TCustomHashMap.this.clear(); }
public void clear() { TCustomHashMap.this.clear(); }
public void clear() { TCustomHashMap.this.clear(); }
/** * rehashes the map to the new capacity. * * @param newCapacity an <code>int</code> value */ @SuppressWarnings({"unchecked"}) @Override 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 ]; } }
/** * 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") @Override 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 */ @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 ) ); }