【发布时间】:2018-04-26 07:11:15
【问题描述】:
我正在尝试用 Kotlin 中的 lambda 表达式替换方法调用,但是出了点问题,我想知道是什么。
这是我的代码:
httpClient.addInterceptor(interceptor: (Interceptor.Chain?) -> Response {
})
这是没有 lambdas 的工作代码:
httpClient.addInterceptor(object : Interceptor {
override fun intercept(chain: Interceptor.Chain?): Response {
}
【问题讨论】:
-
请查看有关lambda syntax的文档。
-
这可能会对您有所帮助。 reddit.com/r/Kotlin/comments/7asvab/…