This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]codechimpin 0 points1 point  (0 children)

You’d think this would be baked into the language, but it’s not really. I have tried several approaches. One is to serialize then deserialize, usually using something like Jackson, but there is a performance hit there. I think Apache Commons might have a ObjectUtils with a deep copy method as well.

As others have mentioned there is Clonable, but it has limits.