Quantcast
Viewing all articles
Browse latest Browse all 173

Comment by Filip Milovanović on Java OOP problem

I'm guessing you misinterpreted some guideline somewhere about when to override equals(). It shouldn't matter that the object is mutable. The very fact that you're working with defensive copies means that you cannot use the in-built reference equality, but rather some form of value equality, and for that, you either have to check against some kind of a surrogate ID, or define equality in terms of the current value of several properties - which you can do by overriding equals().

Viewing all articles
Browse latest Browse all 173

Trending Articles



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