public void ensureCapacity ( int minCapacity ) { int size = _buckets . length ; while ( minCapacity > ( int ) ( size * _loadFactor ) ) { size *= 2 ; } if ( size != _buckets . length ) { resizeBuckets ( size ) ; } }
Ensure that the hash can comfortably hold the specified number of elements . Calling this method is not necessary but can improve performance if done prior to adding many elements .