Originally posted by sweta doshi:
Can you please elaborate on this ? I mean , how does that stop the StringBuffer from overriding equals ?
Thanks
Admittedly, I don't understand the mutable argument either. While it is true that changing the equality and hash code will corrupt a hash map/set, if the mutable instance is used as a key, but so what?
IMHO, I think Sun should have overridden equals() and hashCode(), and let those, who choose to mutate the objects when they are used as keys, get burned.
Henry