Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

罗宾汉哈希 hash_table.HashMap07ByRobinHoodHashing#put #10

Open
BORN1234 opened this issue Oct 16, 2022 · 0 comments
Open

罗宾汉哈希 hash_table.HashMap07ByRobinHoodHashing#put #10

BORN1234 opened this issue Oct 16, 2022 · 0 comments

Comments

@BORN1234
Copy link

当偏移量与key均相同时,需要替换value后结束循环

if (table[idx].key.equals(key)) {
// 发现相同值
V oldVal = table[idx].value;
table[idx].value = value;
break; // <新增>此处应该结束循环
} else {
idx = increment(idx);
entry.offset++;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant