高阶函数类型推断
scala> def greeting(func:(String) => Unit , name:String){ func(name)}
greeting: (func: String => Unit, name: String)Unit
scala> greeting((name:String)=> println("hello "+name) ,"tomcat")
hello tomcat
scala> greeting((name) =>println("--hello--"+name),"kafka" )
--hello--kafka
scala> greeting(name => println(" hi "+name),"spring")
hi spring
scala> def triple(func:(Int)=>Int )={func(3)}
triple: (func: Int => Int)Int
scala> triple((x:Int)=> x *3 )
res8: Int = 9
scala> triple((x)=> x *4 )
res9: Int = 12
scala> triple(x=> x *5 )
res10: Int = 15
scala> triple(_ *5 )
res12: Int = 15