小编Efk*_*fka的帖子

RxJava 2.0和Kotlin Single.zip()以及单曲列表

我有我无法解决的问题。我试图使用Kotlin将.zip(List,)多个Singles合并为一个,而我提供的Function都不适合作为第二个参数。

    fun getUserFriendsLocationsInBuckets(token: String) {
    roomDatabase.userFriendsDao().getUserFriendsDtosForToken(token).subscribe(
            { userFriends: List<UserFriendDTO> ->
                Single.zip(getLocationSingleForEveryUser(userFriends),
                        Function<Array<List<Location>>, List<Location>> { t: Array<List<Location>> -> listOf<Location>() })
            },
            { error: Throwable -> }
    )
}

private fun getLocationSingleForEveryUser(userFriends: List<UserFriendDTO>): List<Single<List<Location>>> =
        userFriends.map { serverRepository.locationEndpoint.getBucketedUserLocationsInLast24H(it.userFriendId) }
Run Code Online (Sandbox Code Playgroud)

Android Studio错误

kotlin rx-java rx-kotlin

5
推荐指数
1
解决办法
2505
查看次数

标签 统计

kotlin ×1

rx-java ×1

rx-kotlin ×1