mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-25 21:26:27 +08:00
Update hashmap
This commit is contained in:
parent
7ad324ac0a
commit
7a284b7a09
2 changed files with 2 additions and 2 deletions
|
@ -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 a new issue