汪星人 发表于 2017-2-13 14:17

HashMap的加载因子为什么默认为0.75

这应该是个经验数字,在Open Hashing中,加载因子选得太大了,访问的时候冲突太多,会降低效率;选得太小了,会浪费大量存储空间。Open Addressing的wikipedia中简略探讨了这个问题。

As the load factor increases towards 100%, the number of probes that may be required to find or insert a given key rises dramatically. Once the table becomes full, probing algorithms may even fail to terminate. Even with good hash functions, load factors are normally limited to 80%.

mengxianqian 发表于 2017-3-3 10:21

谢谢楼主的分享!。。。

劉様 发表于 2017-8-8 07:49

谢谢分享
页: [1]
查看完整版本: HashMap的加载因子为什么默认为0.75