【发布时间】:2018-05-16 13:54:15
【问题描述】:
在 Google 最近发布的 Android 架构组件库中,我们在 Transformations 类中有两个静态函数。虽然map 函数直截了当且易于理解,但我发现很难正确理解switchMap 函数。
switchMap的官方文档可以找到here。
有人可以用一个实际的例子解释一下如何以及在哪里使用 switchMap 函数吗?
【问题讨论】:
-
另见What is the difference between map() and switchMap() methods?。也许不是 100% 重复,但它有一些非常有用的解释
标签: android android-architecture-components android-livedata