diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 25856d352..49e5b6cc4 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -109,6 +109,9 @@
AbstractReferenceMap.SoftRef implements hashCode() but not equals().
+
+ AbstractReferenceMap.WeakRef implements hashCode() but not equals().
+
Add tests for MapUtils.
diff --git a/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java b/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java
index 3aab462d1..346427171 100644
--- a/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java
+++ b/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java
@@ -978,7 +978,7 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap
if (getClass() != obj.getClass()) {
return false;
}
- SoftRef> other = (SoftRef>) obj;
+ final SoftRef> other = (SoftRef>) obj;
return hash == other.hash;
}
}
@@ -999,6 +999,21 @@ public abstract class AbstractReferenceMap extends AbstractHashedMap
public int hashCode() {
return hash;
}
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final WeakRef> other = (WeakRef>) obj;
+ return hash == other.hash;
+ }
}
/**