【发布时间】:2018-09-07 15:57:50
【问题描述】:
我正在重构遗留代码,我想知道下面的代码是否比常规的 RxJava 运算符链更有效?
Observable.just(collection.getItems().asSequence()
.filter { it.itemId == null }
.filter { it.anotherProp == prop }.toList())
谢谢
【问题讨论】:
-
为什么不
filter { it.itemId == null || it.anotherProp == prop } -
@ReneFerrari 是的,它可以像你提议的那样。但问题是这样写是不是一个好方法(just() 中的 kotlin 链)