MCPcopy Create free account
hub / github.com/algorithm004-01/algorithm004-01 / reSize

Method reSize

Week 02/id_416/MyHashMap.java:62–77  ·  view source on GitHub ↗

HashMap数组扩容,增加长度为原来的2倍,并且重新散列,因为散列之后的hash值是根据数组的长度而得出的结果 现在数组的长度变了,所以散列的hash值也会改变 如果不改变的话,由于数组长度变化,相同key,getIndex()方法获取 的值就会不一样了,那么之前的数据将会找不到了。

()

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 1

putMethod · 0.95

Calls 4

getIndexMethod · 0.95
getKeyMethod · 0.65
getNextMethod · 0.65
setNextMethod · 0.65

Tested by

no test coverage detected