/*
- 偏应用函数
- 某些情况下,方法中参数非常多,调用这个方法非常频繁,每次调用只有固定的某个参数变化,
-
其他都不变,可以定义偏应用来实现
- */
def showLog(date:Date,log:String): Unit ={
println(s"date is $date ,log is $log")
}
val date = new Date()
showLog(date,log = “a”)
showLog(date,log = “b”)
showLog(date,log = “c”)
def fun:String =>Unit = showLog(date,_:String)//date值不变,利用下划线代表变值
fun(“aaa”)
fun(“bbb”)
fun(“ccc”)