PMD: AbstractReferenceMap.SoftRef implements hashCode() but not equals()
This commit is contained in:
parent
e84ff4dff0
commit
d22eb8951b
|
@ -106,6 +106,9 @@
|
|||
<action type="fix" dev="ggregory" due-to="Marc Wrobel">
|
||||
Fix minor typos #323
|
||||
</action>
|
||||
<action type="fix" dev="ggregory" due-to="Gary Gregory">
|
||||
AbstractReferenceMap.SoftRef implements hashCode() but not equals().
|
||||
</action>
|
||||
<!-- ADD -->
|
||||
<action issue="COLLECTIONS-760" dev="kinow" type="add" due-to="Isira Seneviratne">
|
||||
Add tests for MapUtils.
|
||||
|
|
|
@ -966,6 +966,21 @@ public abstract class AbstractReferenceMap<K, V> extends AbstractHashedMap<K, V>
|
|||
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;
|
||||
}
|
||||
SoftRef<?> other = (SoftRef<?>) obj;
|
||||
return hash == other.hash;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue