
我(困惑)的尝试:
fooContainerObservable .map(container -> container.getFooList()) .flatMap(foo -> transformFooToFoobar(foo)) .collect( /* What do I do here? Is collect the correct thing? Should I be using lift? */) .subscribe(foobarList -> /* display the List */);
我的混乱(或至少有一点)是将平整列表移回列表的步骤.
注意:我试图在AndroID应用程序中执行此 *** 作.
解决方法 toList可以将Observable的所有项目收集到列表中并发出. toList可以使用collect来实现,但它比收集容易得多.例如,它将是:fooContainerObservable .map(container -> container.getFooList()) .flatMap(foo -> transformFooToFoobar(foo)) .toList() .subscribe(foobarList -> /* display the List */);总结
以上是内存溢出为你收集整理的android – 使用RxJava获取对象,转换包含的列表,并使用列表全部内容,希望文章能够帮你解决android – 使用RxJava获取对象,转换包含的列表,并使用列表所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)