本文整理汇总了Java中io.reactivex.Single.defer方法的典型用法代码示例。如果您正苦于以下问题:Java Single.defer方法的具体用法?Java Single.defer怎么用?Java Single.defer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.reactivex.Single
的用法示例。
在下文中一共展示了Single.defer方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRecipeForWidgetDisplay
import io.reactivex.Single; //导入方法依赖的package包/类
@Override
public Single<Recipe> getRecipeForWidgetDisplay() {
return Single.defer(() -> {
Integer recipeForDisplayId = recipesUserPreferencesDataSource.getRecipeIdForWidgetDisplay();
if(recipeForDisplayId != Recipe.INVALID_ID) {
return recipesLocalDataSource.get(recipeForDisplayId).toSingle();
} else {
return Single.error(new RuntimeException("Recipe for display not found"));
}
});
}
示例2: login
import io.reactivex.Single; //导入方法依赖的package包/类
public Single<Integer> login(final BrokerLoginData brokerLoginData) {
return Single.defer(() -> !loginRetryTimer.isLoginPermitted()
? Single.just(ZorroReturnValues.LOGIN_FAIL.getValue())
: loginTask(brokerLoginData));
}
示例3: get
import io.reactivex.Single; //导入方法依赖的package包/类
public Single<Long> get() {
return Single.defer(this::fromRepository);
}
示例4: get
import io.reactivex.Single; //导入方法依赖的package包/类
public Single<Integer> get(final BrokerTimeData brokerTimeData) {
return Single.defer(() -> client.isConnected()
? fillServerTimeAndReturnStatus(brokerTimeData)
: Single.just(ZorroReturnValues.CONNECTION_LOST_NEW_LOGIN_REQUIRED.getValue()));
}
示例5: serverTimeFromTick
import io.reactivex.Single; //导入方法依赖的package包/类
private Single<Long> serverTimeFromTick() {
return Single.defer(() -> {
logger.warn("Currently no NTP available, estimating with latest tick time...");
return tickTimeProvider.get();
});
}
示例6: isStored
import io.reactivex.Single; //导入方法依赖的package包/类
@Override
public Single<Boolean> isStored() {
return Single.defer(() -> Single.just(!mUserDatabase.localUserDao().getUsers().isEmpty()));
}