scala map function to collection

object PutFunctionToCollection {

    def main(args:Array[String]): Unit ={
      val name = List("Peter","Paul","Mary")
        name.map(_.toUpperCase)
        def ulcase(s:String) = Vector(s.toUpperCase(),s.toLowerCase())
       name.map(ulcase).foreach(System.out.println(_))
    }

}

List(1,7,2,9).reduceLeft(_-_)
//((1-7)-2)-9 = -17

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324885939&siteId=291194637