Skip to content

Instantly share code, notes, and snippets.

@rohans-doordash
Last active June 29, 2017 20:07
Show Gist options
  • Save rohans-doordash/2c59b83b8c777e1fc31c4d01f27a09ea to your computer and use it in GitHub Desktop.
Save rohans-doordash/2c59b83b8c777e1fc31c4d01f27a09ea to your computer and use it in GitHub Desktop.
Fetch restaurants with their Yelp rating and review count
public Single<Pair<List<Restaurant>, Boolean>> getRestaurantList(int userId) {
Single<List<Restaurant>> restaurantListSingle =
ddApi.getUserInfo(userId).flatMap(user -> {
return ddApi.getAvailableRestaurant(user.defaultAddress.lat, user.defaultAddress.lng);
});
Single<Boolean> showPhotoExperimentSingle =
ddApi.getShowPhotosExperiment(userId);
return restaurantListSingle.zipWith(showPhotoExperimentSingle, Pair::new);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment