修复特定情况下BiMap覆盖Value后,仍能通过旧Value查询到Key问题

This commit is contained in:
Looly
2023-10-18 08:57:30 +08:00
parent 5d8a411453
commit e46474fc9a
3 changed files with 25 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
package cn.hutool.core.map;
import org.junit.Assert;
import org.junit.Test;
import java.util.LinkedHashMap;
public class IssueI88R5MTest {
@Test
public void biMapTest() {
final BiMap<String, Integer> biMap = new BiMap<>(new LinkedHashMap<>());
biMap.put("aaa", 111);
biMap.getKey(111);
biMap.put("aaa", 222);
Assert.assertNull(biMap.getKey(111));
}
}