Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Clone an object in Java
private User testUser;
public User getTestUser() {
Gson gson = new Gson();
return gson.fromJson(gson.toJson(testUser), User.class);

This comment has been minimized.

Copy link
Owner Author

LenarBad commented Nov 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.