Bugfix: Our entries should compare as equal to any Map.Entry<Integer, K>

with the same key and value.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2656 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray.j.greenwell
2009-12-01 21:34:58 +00:00
parent 00ede903a2
commit 57dffcb1a5
+11 -4
View File
@@ -560,12 +560,19 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
@Override public boolean equals (Object o)
{
if (!(o instanceof IntEntry<?>)) {
if (o instanceof IntEntry<?>) {
IntEntry<?> that = (IntEntry<?>)o;
return (this.key == that.getIntKey()) &&
ObjectUtil.equals(this.value, that.getValue());
} else if (o instanceof Entry<?,?>) {
Entry<?,?> that = (Entry<?,?>)o;
return (this.getKey().equals(that.getKey())) &&
ObjectUtil.equals(this.value, that.getValue());
} else {
return false;
}
IntEntry<?> that = (IntEntry<?>)o;
return (this.key == that.getIntKey()) &&
ObjectUtil.equals(this.value, that.getValue());
}
@Override public int hashCode ()