关于负载系数,我只是引用从
HashMap javadoc:
As a general rule, the default load factor (.75) offers a good tradeoff between time and space costs. Higher values decrease the space overhead but increase the lookup cost (reflected in most of the operations of the HashMap class, including get and put). The expected number of entries in the map and its load factor should be taken into account when setting its initial capacity, so as to minimize the number of rehash operations. If the initial capacity is greater than the maximum number of entries divided by the load factor, no rehash operations will ever occur.
意思是,负载系数不应该从.75改变,除非你有一些特定的优化,你打算做。初始容量是你想要改变的唯一的东西,并根据你的N值 – 意思(N / 0.75)1,或在那个地方的东西设置。这将确保表将总是足够大,并且不会发生重新散列。