作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试转换为 Kotlin。
但是responseBody类型不匹配。
handleHeavyContent(
event.replyToken,
event.message.id
) {responseBody ->
}
必填:消费者
找到:(???) -> 单位
最佳答案
嘿,我遇到了同样的问题,所以经过一番搜索后,我终于想出了一些在函数中定义 lambda 的方法。在你的情况下我会做这样的事情
fun handleHeavyContent(
event.replyToken,
event.message.id,
response : (ResponseBody) -> Unit){
//do your code and get the response body and pass it to the variable
// get the body from a function or object and then use it like this
val body : ResponseBody //initialize it here
response(body)
}
希望这对你有帮助
关于java - 如何在 Kotlin 中使用 Lambda handleHeavyContent(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57389591/
示例代码:https://github.com/line/line-bot-sdk-java/blob/master/sample-spring-boot-kitchensink/src/main/j
我是一名优秀的程序员,十分优秀!