Created
November 20, 2017 22:54
-
-
Save LenarBad/268a71c7104ed29e0c0343bf7867e9ba to your computer and use it in GitHub Desktop.
Clone an object in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private User testUser; | |
public User getTestUser() { | |
Gson gson = new Gson(); | |
return gson.fromJson(gson.toJson(testUser), User.class); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Clone objects and lists in Java