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:
@@ -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 ()
|
||||
|
||||
Reference in New Issue
Block a user