@Ray - note two things: (1) a mutable object can have immutable aspects to it (i.e. a subset of the fields that are immutable) - you can use those fields as a key to derive a hash from, and check equality against (if the object is to be considered the "same" after mutation, e.g. like how a Person instance is still the same when you update their address). (2) If a mutable object is not to be considered the same as its copy stored in a set after certain fields change, then there's also no problem - the "new" object is not in the set. Just take care not to mutate the set copy
↧