package day3 object demo_high_func { def main(args: Array[String]): Unit = { val list = Array(1,2,3,4,5,6,7,8) // 过滤数组中的元素, 将为true的元素组合成一个新的数组 val list2 = list.filter(e=>e%2==0) println(list2.mkString("[",",","]")) // map函数,对每个元素操作,组合成一个新集合 println("-" * 40 + "map" + "-" * 40) val list3 = list.map(n=>n * 10) println(list3.mkString("[",",","]")) } }