Skip to content

Instantly share code, notes, and snippets.

@JosephRoskopfOPI
Last active Nov 25, 2017
Embed
What would you like to do?
public class TestViewModel extends ViewModel {
private ArrayList<User> users;
ArrayList<User> getUsers() {
if(users == null){
return fetchUsersFromNetwork();
} else {
return users;
}
}
ArrayList<User> fetchUsersFromNetwork() {
/**
* Network call to fetch users
*/
return users;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment