Initial capacity for a HashSet<Integer>
问题 What Initial Capacity should I use for a HashSet into which I know that I am going to insert 1000 integers to prevent the need for any internal rebuilds ? At first I though that I should use 1000 but reading the description of the constructor that taks the initialCapacity parameter it says Constructs a new, empty set; the backing HashMap instance has the specified initial capacity and default load factor (0.75). . So If I set capacity to 1000 the hashMap will resize when reaching 750 elements