提交 7fc72e9d authored 作者: Thomas Mueller's avatar Thomas Mueller

There was a bug in the internal IntIntHashMap.

上级 c6d0f8fc
...@@ -42,6 +42,7 @@ public class IntIntHashMap extends HashBase { ...@@ -42,6 +42,7 @@ public class IntIntHashMap extends HashBase {
if (key == 0) { if (key == 0) {
zeroKey = true; zeroKey = true;
zeroValue = value; zeroValue = value;
return;
} }
try { try {
checkSizePut(); checkSizePut();
......
...@@ -28,6 +28,13 @@ public class TestIntIntHashMap extends TestBase { ...@@ -28,6 +28,13 @@ public class TestIntIntHashMap extends TestBase {
} }
public void test() { public void test() {
IntIntHashMap map = new IntIntHashMap();
map.put(1, 1);
map.put(1, 2);
assertEquals(1, map.size());
map.put(0, 1);
map.put(0, 2);
assertEquals(2, map.size());
rand.setSeed(10); rand.setSeed(10);
test(true); test(true);
test(false); test(false);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论