in reply to Re^2: OO Identity Crisis
in thread OO Identity Crisis
Sort of. If we're using tlm's approach of a hashtable anyway (see return $self->{ N }{ $id } ||= $node;), then --- as far as I know --- Java's Hashtable combines the Object class's overridable methods equals and hashCode to do what we want. Basically, it avoids comparing the given object with each existing object by comparing it only to those with the same hashcode; but if you have a poor hashcode function (like return 0;), it will compare with everything.
|
|---|