我如何重构这段逻辑?我不喜欢return Completable.complete()
Completable
.defer(() -> {
if (object.id != null)
{
return incrementNumberOfObjectsInDbCompletable(object);
}
else
{
return Completable.complete();
}
});
UPD: 那怎么样:
return Single.just(object)
.filter(object -> object.id != null)
.flatMapCompletable(object -> incrementNumberOfObjectInDbCompeltable(oper, object));