From dd5b2c30c58d09bf962356069e5db6814894d918 Mon Sep 17 00:00:00 2001 From: nmittler Date: Mon, 20 Oct 2014 08:58:38 -0700 Subject: [PATCH] Allowing negative keys in IntObjectHashMap. Motivation: IntObjectHashMap throws an exception when using negative values for keys. Modifications: Changed hashIndex() to normalize the index if the mod operation returns a negative number. Result: IntObjectHashMap supports negative key values. --- .../java/io/netty/util/collection/IntObjectHashMap.java | 6 +++++- .../io/netty/util/collection/IntObjectHashMapTest.java | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/io/netty/util/collection/IntObjectHashMap.java b/common/src/main/java/io/netty/util/collection/IntObjectHashMap.java index 354ccec81c..4d1cdfc78f 100644 --- a/common/src/main/java/io/netty/util/collection/IntObjectHashMap.java +++ b/common/src/main/java/io/netty/util/collection/IntObjectHashMap.java @@ -311,7 +311,11 @@ public class IntObjectHashMap implements IntObjectMap, Iterable