- 哈希表中可以有任意数量的记录吗?
- 如果我们有更多记录(例如大约 10000 条记录),使用 Hashtable 是否有效?
使用 Hashtable 在效率方面有什么缺点吗?
谢谢。
最佳答案
disadvantage HashTable的效率为:
Hash tables become quite inefficient when there are many collisions. While extremely uneven hash distributions are extremely unlikely to arise by chance, a malicious adversary with knowledge of the hash function may be able to supply information to a hash that creates worst-case behavior by causing excessive collisions, resulting in very poor performance, e.g. a denial of service attack.[21] In critical applications, universal hashing can be used; a data structure with better worst-case guarantees may be preferable.[22]
您可以使用 HashMap,因为它们比 HashTable 更好,是一个不错的选择。
关于java - 哈希表的缺点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24261326/