Sometimes we need to clone an object in Java, but not a reference (a junior developer may use). There are several ways to achieve this task; however, I recommend to use a copy-constructor (that comes from C++) and, in particular, using @Builder from Lombok (to avoid boilerplate code))
No comments :
Post a Comment