Skip to content

Instantly share code, notes, and snippets.

@koifish082
Last active November 21, 2018 03:07
Show Gist options
  • Save koifish082/216eab1fd9e868c0906b62bb9afb9c0c to your computer and use it in GitHub Desktop.
Save koifish082/216eab1fd9e868c0906b62bb9afb9c0c to your computer and use it in GitHub Desktop.
Maybe<List<Long>> maybe = Maybe
.zip(
webViewRepository.getHabitReadArticle(webView),
habitReadArticleDao.getAll(),
new BiFunction<HabitReadArticleWebViewLocal, List<HabitReadArticle>, List<Long>>() {
@Override
public List<Long> apply(HabitReadArticleWebViewLocal habitReadArticleWebViewLocal, List<HabitReadArticle> habitReadArticles) throws Exception {
if (!hasSameArticleIds(habitReadArticleWebViewLocal, habitReadArticles)) {
return saveArticles(habitReadArticleWebViewLocal);
}
return null;
}
}
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
disposables.add(maybe.subscribeWith(new ImportWebViewLocalObserver()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment