Skip to content

Instantly share code, notes, and snippets.

@amitshekhariitbhu
Created May 17, 2018 14:10
Show Gist options
  • Save amitshekhariitbhu/53dfb7e49602d83633cf763381df48fb to your computer and use it in GitHub Desktop.
Save amitshekhariitbhu/53dfb7e49602d83633cf763381df48fb to your computer and use it in GitHub Desktop.
getUserObservable()
.map(new Function<ApiUser, User>() {
@Override
public User apply(ApiUser apiUser) throws Exception {
// here we get the ApiUser from the server
User user = new User(apiUser);
// then by converting it into the user, we are returning
return user;
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getObserver());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment