in src/main/java/org/apache/commons/logging/impl/WeakHashtable.java [450:477]
public boolean equals(final Object o) {
boolean result = false;
if (o instanceof Referenced) {
final Referenced otherKey = (Referenced) o;
final Object thisKeyValue = getValue();
final Object otherKeyValue = otherKey.getValue();
if (thisKeyValue == null) {
result = otherKeyValue == null;
// Since our hash code was calculated from the original
// non-null referant, the above check breaks the
// hash code/equals contract, as two cleared Referenced
// objects could test equal but have different hash codes.
// We can reduce (not eliminate) the chance of this
// happening by comparing hash codes.
result = result && this.hashCode() == otherKey.hashCode();
// In any case, as our c'tor does not allow null referants
// and Hashtable does not do equality checks between
// existing keys, normal hashtable operations should never
// result in an equals comparison between null referants
}
else
{
result = thisKeyValue.equals(otherKeyValue);
}
}
return result;
}