public void ensureCapacity ( int additionalCapacity ) { int sizeNeeded = size + additionalCapacity ; if ( sizeNeeded >= threshold ) resize ( ObjectMap . nextPowerOfTwo ( ( int ) ( sizeNeeded / loadFactor ) ) ) ; }
Increases the size of the backing array to acommodate the specified number of additional items . Useful before adding many items to avoid multiple backing array resizes .