From 57dffcb1a5bc4e091401ac9c59dfd5564d8cc4f2 Mon Sep 17 00:00:00 2001 From: "ray.j.greenwell" Date: Tue, 1 Dec 2009 21:34:58 +0000 Subject: [PATCH] Bugfix: Our entries should compare as equal to any Map.Entry with the same key and value. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2656 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- src/java/com/samskivert/util/HashIntMap.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/java/com/samskivert/util/HashIntMap.java b/src/java/com/samskivert/util/HashIntMap.java index 8614e590..73d7ba36 100644 --- a/src/java/com/samskivert/util/HashIntMap.java +++ b/src/java/com/samskivert/util/HashIntMap.java @@ -560,12 +560,19 @@ public class HashIntMap extends AbstractMap @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 ()