Using a LinkedHashSet follows a βlinkedβ list of entries, so the number of spaces doesn't matter. Usually you will not have a HashSet, where the capacity is much more than twice the size used. Even if you do, scanning a million records, basically null does not take much time (milliseconds)
Peter Lawrey
source share