Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
When items are removed from the IntHashSet, special "placeholders" take their place (and take up a slot in the table). When the table needs expanding due to the load factor, the copying into the new table will drop these placeholders, thus "reclaiming" the space. Resizing is triggered by the size + nbrRemoved exceeding the load factor. If the nbrRemoved is >= size, then keeping the same size table (instead of doubling it's size) will bring the load factor down to what it would have been in the absence of removes, when the table size was doubled. Change the reallocate to keep the size in this case (but still do the copying - which cleans up the removal placeholders).