Quantcast
Channel: User Filip Milovanović - Software Engineering Stack Exchange
Viewing all articles
Browse latest Browse all 167

Comment by Filip Milovanović on Java OOP problem

$
0
0
@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

Viewing all articles
Browse latest Browse all 167

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>