Thanks for the post! Elaborating on why it is a bad idea to use copy() on data classes with mutable attributes is because if the mutable attributes are updated after the object is copied then both the original and new object will have it’s attribute values altered producing potentially unintended consequences.

Copy only works well on entirely immutable objects.

--

--

Open Sourcer

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store