/** {@inheritDoc} */ public long put( K key, long value ) { int index = insertKey( key ); return doPut( value, index ); }
/** {@inheritDoc} */ public long putIfAbsent( K key, long value ) { int index = insertKey(key); if ( index < 0 ) return _values[-index - 1]; return doPut( value, index ); }
/** {@inheritDoc} */ public long adjustOrPutValue( final K key, final long adjust_amount, final long put_amount ) { int index = insertKey( key ); final boolean isNewMapping; final long newValue; if ( index < 0 ) { index = -index -1; newValue = ( _values[index] += adjust_amount ); isNewMapping = false; } else { newValue = ( _values[index] = put_amount ); isNewMapping = true; } //noinspection unchecked if ( isNewMapping ) { postInsertHook( consumeFreeSlot ); } return newValue; }
/** * rehashes the map to the new capacity. * * @param newCapacity an <code>int</code> value */ protected void rehash( int newCapacity ) { int oldCapacity = _set.length; //noinspection unchecked K oldKeys[] = ( K[] ) _set; long oldVals[] = _values; _set = new Object[newCapacity]; Arrays.fill( _set, FREE ); _values = new long[newCapacity]; Arrays.fill( _values, no_entry_value ); for ( int i = oldCapacity; i-- > 0; ) { if( oldKeys[i] != FREE && oldKeys[i] != REMOVED ) { K o = oldKeys[i]; int index = insertKey(o); if ( index < 0 ) { throwObjectContractViolation( _set[ (-index -1) ], o); } _set[index] = o; _values[index] = oldVals[i]; } } }
/** {@inheritDoc} */ public long put( K key, long value ) { int index = insertKey( key ); return doPut( value, index ); }
/** {@inheritDoc} */ public long putIfAbsent( K key, long value ) { int index = insertKey(key); if ( index < 0 ) return _values[-index - 1]; return doPut( value, index ); }
/** {@inheritDoc} */ @Override public long put( K key, long value ) { int index = insertKey( key ); return doPut( value, index ); }
/** {@inheritDoc} */ public long putIfAbsent( K key, long value ) { int index = insertKey(key); if ( index < 0 ) return _values[-index - 1]; return doPut( value, index ); }
/** {@inheritDoc} */ @Override public long putIfAbsent( K key, long value ) { int index = insertKey(key); if ( index < 0 ) return _values[-index - 1]; return doPut( value, index ); }
/** {@inheritDoc} */ public long put( K key, long value ) { int index = insertKey( key ); return doPut( value, index ); }
/** {@inheritDoc} */ public long adjustOrPutValue( final K key, final long adjust_amount, final long put_amount ) { int index = insertKey( key ); final boolean isNewMapping; final long newValue; if ( index < 0 ) { index = -index -1; newValue = ( _values[index] += adjust_amount ); isNewMapping = false; } else { newValue = ( _values[index] = put_amount ); isNewMapping = true; } //noinspection unchecked if ( isNewMapping ) { postInsertHook( consumeFreeSlot ); } return newValue; }
/** {@inheritDoc} */ public long adjustOrPutValue( final K key, final long adjust_amount, final long put_amount ) { int index = insertKey( key ); final boolean isNewMapping; final long newValue; if ( index < 0 ) { index = -index -1; newValue = ( _values[index] += adjust_amount ); isNewMapping = false; } else { newValue = ( _values[index] = put_amount ); isNewMapping = true; } //noinspection unchecked if ( isNewMapping ) { postInsertHook( consumeFreeSlot ); } return newValue; }
/** {@inheritDoc} */ @Override public long adjustOrPutValue( final K key, final long adjust_amount, final long put_amount ) { int index = insertKey( key ); final boolean isNewMapping; final long newValue; if ( index < 0 ) { index = -index -1; newValue = ( _values[index] += adjust_amount ); isNewMapping = false; } else { newValue = ( _values[index] = put_amount ); isNewMapping = true; } //noinspection unchecked if ( isNewMapping ) { postInsertHook( consumeFreeSlot ); } return newValue; }
/** * rehashes the map to the new capacity. * * @param newCapacity an <code>int</code> value */ protected void rehash( int newCapacity ) { int oldCapacity = _set.length; //noinspection unchecked K oldKeys[] = ( K[] ) _set; long oldVals[] = _values; _set = new Object[newCapacity]; Arrays.fill( _set, FREE ); _values = new long[newCapacity]; Arrays.fill( _values, no_entry_value ); for ( int i = oldCapacity; i-- > 0; ) { if( oldKeys[i] != FREE && oldKeys[i] != REMOVED ) { K o = oldKeys[i]; int index = insertKey(o); if ( index < 0 ) { throwObjectContractViolation( _set[ (-index -1) ], o); } _set[index] = o; _values[index] = oldVals[i]; } } }
/** * rehashes the map to the new capacity. * * @param newCapacity an <code>int</code> value */ protected void rehash( int newCapacity ) { int oldCapacity = _set.length; //noinspection unchecked K oldKeys[] = ( K[] ) _set; long oldVals[] = _values; _set = new Object[newCapacity]; Arrays.fill( _set, FREE ); _values = new long[newCapacity]; Arrays.fill( _values, no_entry_value ); for ( int i = oldCapacity; i-- > 0; ) { if( oldKeys[i] != FREE && oldKeys[i] != REMOVED ) { K o = oldKeys[i]; int index = insertKey(o); if ( index < 0 ) { throwObjectContractViolation( _set[ (-index -1) ], o); } _set[index] = o; _values[index] = oldVals[i]; } } }
/** * 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; //noinspection unchecked K oldKeys[] = ( K[] ) _set; long oldVals[] = _values; _set = new Object[newCapacity]; Arrays.fill( _set, FREE ); _values = new long[newCapacity]; Arrays.fill( _values, no_entry_value ); for ( int i = oldCapacity; i-- > 0; ) { if( oldKeys[i] != FREE && oldKeys[i] != REMOVED ) { K o = oldKeys[i]; int index = insertKey(o); if ( index < 0 ) { throwObjectContractViolation( _set[ (-index -1) ], o); } _set[index] = o; _values[index] = oldVals[i]; } } }