def main(args: Array[String]): Unit = {
//匿名函数 () => Unit 是匿名函数类型 函数体() => println("I'm an anonymous function")
val f1: () => Unit = () => println("I'm an anonymous function")
//匿名函数
val f2= (a:Int)=>{
println(a)
}
var f3 :(Int)=>Unit = (x) => {println(x)} //与f2等效
//f1()
//f2(100)
var theList1 = List(1,2,3,4,5,6,7,8,9)//Scala的泛型
var theList2 = GetSort[Int](theList1,5,(x,y)=>x>y)
var theList3 = GetSort[Int](theList1,5,MyCompare)
theList2.foreach(print)
println("===========")
theList3.foreach(prin
...
继续阅读
(18)