LongKeyIntOpenHashMap methods throw ArrayIndexOutOfBounds
Brought to you by:
bak
Under certain circumstances, methods in LongKeyIntOpenHashMap (and possibly other HashMaps) throw ArrayIndexOutOfBoundsException. This is because of code like this:
public boolean containsKey(long key) {
int h = Math.abs(keyhash.hash(key));
int i = h % keys.length;
if (states[i] != EMPTY)
...
}
Math.abs() returns negative numbers for Integer.MAX_VALUE. Rather than Math.abs(), the highest-order bit in the hash code should be masked out, i.e. keyhash.hash(key) & 0x7FFFFFFF.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
Correction: Integer.MAX_VALUE should be Integer.MIN_VALUE.