kotlin把函数作为参数转递给另一个函数
fun say(s: String, foo: (String) -> Unit) {print("hello")foo(s) }fun hi(str: String) {println(str) }fun main(args: Array) {say("hello", ::hi) }
输出:
hellohello
上一篇:【XXL-JOB】XXL-JOB定时处理视频转码
下一篇:Mybatis动态sql语句foreach中拼接正则表达式字符串注意事项