Javadok, Javadok, Javadok. This is the first place you look. The HashMap says:
Typically, the default load factor (.75) offers a good compromise between time and space. Higher values reduce overhead but increase the cost of the search (reflected in most HashMap operations, including get and put). the expected number of entries on the map and the load factor when establishing its initial capacity, in order to minimize the number of paraphrase operations. If the initial capacity is greater than the maximum number of records divided by the load factor, no re-evacuation operations will ever occur.
As with the hash theory, if your card is full, then you are doing something very, very wrong. By then, you're probably in O(sqrt(N)) when searching with random data - BAD. You never want your hash file to be populated. But a very rare map will spend too much space (as you noticed), and iteration will take too long. Therefore, for most use cases there should be a load factor that is less than 1.
Note: "Empty space" is proportional to the size of the card and inversely proportional to the load factor. However, search time has a more complex expected performance feature. This means that the same load factor will not work for different hash cards of different sizes, as this will mean different trade-offs between the scales.
A general overview of trade-offs can be found in Knuth's book, The Art of Programming, vol 3.
Ordous
source share