Difference between Observable.create() and Observable.fromCallable()

帅比萌擦擦* 提交于 2019-12-03 12:39:06

Observable.create let's you emit multiple items while fromCallable emits only a single item.

You should use the latter as it is more expressive about the intent of having a single element sequence and has a slighly lower overhead.

Drawback is that you can't have an async single element source with it whereas create let's you delay the call to onNext to a later point in time.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!