标签:style blog color io ar java for strong sp
1. Arbitrary multi parameters funcs
sum(1,2,3,4,5) = sum(1 to 5: _*)
the equal ‘=‘ can be ignored if there is none return val
1 def sum(args: Int*) = { 2 var result = 0 3 for(arg <- args) result += arg 4 result 5 }
1 import scala.collection.JavaConversions.bufferAsJavaList 2 import scala.collection.mutable.ArrayBuffer 3 val command = ArrayBuffer("ls","-al","/home/mike") 4 val pb = new ProcessBuilder(command)
reverse operation
1 import scala.collection.JavaConversion.asScalaBuffer 2 import scala.collection.mutable.Buffer 3 val cmd:Buffer[String] = pb.command()
Hash Map
1 val hs01 = Map("s01" -> 342342,"s02" -> 4245) 2 hs01.getOrElse("s01",0)
标签:style blog color io ar java for strong sp
原文地址:http://www.cnblogs.com/mikedeng/p/4008808.html