Skip to content

Instantly share code, notes, and snippets.

@LenarBad LenarBad/
Last active Nov 20, 2017

What would you like to do?
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));

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.