throwObjectContractViolation(_set[(-index - 1)], o, size(), oldSize, oldKeys);
/** * 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; 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; ) { if ( oldKeys[ i ] == FREE || oldKeys[ i ] == REMOVED ) continue; Object o = oldKeys[ i ]; int index = insertionIndex( ( K ) 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; 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); }
throwObjectContractViolation(_set[(-index - 1)], o, size(), oldSize, oldKeys);
throwObjectContractViolation(_set[(-index - 1)], o, size(), oldSize, oldKeys);