问题描述
我有这段代码,你可以在 switchMap() 之后看到我收到 Flowable
我需要调用 scan(initial,selector) 或 scan(selector)
应该调用哪个 scan() 方法取决于 Data 对象具有的属性。该属性与我们传递给调用方法 isOnline
`private Flowable<Data> call (
Flowable<A> a,Flowable<B> b,C initial,boolean isOnline) {
return Flowable.combineLatest(
a,b,(a,b) -> {
return ....;
})
.switchMap()
///here based on the Data isOnline property I need to call either
///scan(initial,selector) or scan(selector) and then continue....
.map()
.distinctUntilChanged()
.toObservable()
.compose()
.compose()
.toFlowable(BUFFER)
}
我想知道下面发布的以下内容是否是一个好主意(安全),或者我们可以将它们组合在一个链中而没有其他但有一些 rx 方法,我可以根据该属性调用扫描方法(第二个选项我不知道怎么实现)
Flowable<Data>part1= return Flowable.combineLatest(a,b) -> {
return ....;
})
.switchMap();
if(isOnline){
part2 = part1.scan(initial,selector);
}else{
part2 = part1.scan(selector);
}
//and then I can continue the chain on part2.
````
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)