If I use a HashSet
with a initial capacity of 10 and a load factor of 0.5
then every 5 elements added the HashSet
will be increased or first the HashSet
is increased of 10 elements and after at 15 at 20 atc. the capacity will be increased?
The load factor is a measure of how full the HashSet is allowed to get before its capacity is automatically increased. When the number of entries in the hash table exceeds the product of the load factor and the current capacity, the hash table is rehashed (that is, internal data structures are rebuilt) so that the hash table has approximately twice the number of buckets.