package test40 object test4 { def getMax(intList: List[Int]): Int = { intList.foldLeft(intList.head)(math.max) } def getMax(doubleList: List[Double]): Double = { doubleList.foldLeft(doubleList.head)(math.max) } def main(args: Array[String]): Unit = { val rs1 = getMax(List(1,3,2)) println(rs1) val rs2 = getMax(List(1.1,2.0,4.0)) println(rs2) } }
作业作业作业
最新推荐文章于 2025-05-26 12:10:34 发布