|
|
1
2
在查看SimpleArrayMap实现之后,当调用put、putAll或remove方法时,它似乎会动态地增长和收缩。此时,索引可能会更改。如果你打电话
更仔细地看,indexOf方法需要搜索项目的假定索引,因为在缩小映射时,索引的键哈希的内部数组似乎不会更新。所以指数可以明显改变。
索引方法可能存在于您知道没有修改映射的情况下。
更新:
为了实现您想要的功能,您需要实现
我想说,如果您希望对底层映射进行更改,那么使用索引方法可能不是最佳选择,因为缓存的索引必须更新。 |
|
AmirSina01 · 从对象中获取HashMap值[重复] 1 年前 |
|
|
Maam maam · 运行时错误,因为“unsigned int” 2 年前 |
|
|
Expert · HashMap中的矢量[重复] 2 年前 |
|
|
Ariana · 在C中初始化hash_map++ 2 年前 |
|
|
TheOdinBorson · Leetcode To K频繁元素 2 年前 |