fuzhengwei / fuzhengwei/java-algorithms

罗宾汉哈希 hash_table.HashMap07ByRobinHoodHashing#put

Open
#10 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
349
Forks
151
PR merge metrics
No merged PRs in 30d

Description

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

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.