Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question I was thinking about mutable objects and how they’re weird (but very cool). Question: can a mutable object not equal itself? Only caveat here is
Tag: mutable
Java mutable object to causing nullpointer exception
I have the following DTO and I pass the objects to the ArrayLists to prevent objects to be changed and fix the SonarQube error as “Message: Store a copy of allergenInfoList”, etc. However, this approach requires null check and it makes my code ugly as shown below: So, is there any better approach to fix the problem without null check?