mirror of
https://github.com/krahets/hello-algo.git
synced 2025-01-24 06:50:26 +08:00
Update hashmap
This commit is contained in:
parent
7ad324ac0a
commit
7a284b7a09
@ -52,7 +52,7 @@ class ArrayHashMap {
|
|||||||
/* 删除操作 */
|
/* 删除操作 */
|
||||||
public void remove(int key) {
|
public void remove(int key) {
|
||||||
int index = hashFunc(key);
|
int index = hashFunc(key);
|
||||||
// 置为空字符,代表删除
|
// 置为 null ,代表删除
|
||||||
bucket.set(index, null);
|
bucket.set(index, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ $$
|
|||||||
/* 删除操作 */
|
/* 删除操作 */
|
||||||
public void remove(int key) {
|
public void remove(int key) {
|
||||||
int index = hashFunc(key);
|
int index = hashFunc(key);
|
||||||
// 置为空字符,代表删除
|
// 置为 null,代表删除
|
||||||
bucket.set(index, null);
|
bucket.set(index, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user