我目前正在开展一个旨在模拟生物钟的假期项目。总而言之,我决定使用哈希表作为“集中”对象来模拟单元格及其交互单元。
我的主要问题是:是否可以以恒定大小的方式使用 Java 标准 HashTable?即无论输入如何(将受到适当限制),它都不会改变。
提前致谢! 大卫
最佳答案
构造函数HashTable(int)
将初始容量作为参数。默认负载因子为 0.75。然后:
No rehash operations will ever occur if the initial capacity is greater than
the maximum number of entries the Hashtable will contain divided by its
load factor.
关于java - 具有恒定大小的哈希表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8465301/