Scala 方法接受变参

   def Parametron(strings:String*): Unit ={
        strings.foreach(x=>{
          println(x)
          if (x=="88")
           println(s"********** ${x.toInt}************")
        })
      }

    val s4=Parametron("soyo soyo1", "xiaozhou","xiaohang","soyo5","88")
   val list=List("小海","小周","小华")    //List Array Seq 都ok
     val s5=Parametron(list:_*)

 

 

posted @ 2017-10-24 21:02  soyosuyang  阅读(205)  评论(0编辑  收藏  举报