Skip to content

Instantly share code, notes, and snippets.

@LenarBad
Last active November 20, 2017 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LenarBad/8772b3f072703058cac24ed8ca333129 to your computer and use it in GitHub Desktop.
Save LenarBad/8772b3f072703058cac24ed8ca333129 to your computer and use it in GitHub Desktop.
Clone lists in Java with Gson
private List<User> testUsers;
public List<User> getTestUsers() {
Gson gson = new Gson();
return Arrays.asList(gson.fromJson(gson.toJson(testUsers), User[].class));
}
@LenarBad
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment