Hash Set With Expected Size(int expectedSize) Method
Returns a new hash set using the smallest initial table size that can hold
expectedSize elements without resizing. Note that this is not what HashSet#HashSet(int) does, but it is what most users want and expect it to do.
This behavior can't be broadly guaranteed, but has been tested with OpenJDK 1.7 and 1.8.
public static HashSet<E> <E>newHashSetWithExpectedSize(int expectedSize)
the number of elements you expect to add to the returned set
a new, empty hash set with enough capacity to hold