Last active
November 20, 2017 23:30
-
-
Save LenarBad/8772b3f072703058cac24ed8ca333129 to your computer and use it in GitHub Desktop.
Clone lists in Java with Gson
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 List<User> testUsers; | |
public List<User> getTestUsers() { | |
Gson gson = new Gson(); | |
return Arrays.asList(gson.fromJson(gson.toJson(testUsers), 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