Scala 解析参数
object ParamParser { def main(args: Array[String]): Unit = { val list = List("--table", "app.app_dm_online_log", "--memory", "4G") parse(list) println(tableName) println(memory) } var tableName: String = _ var memory: String = _ def parse(list: List[String]): Unit = list match { case "--table" :: value :: tail => tableName = value; parse(tail) case "--memory" :: value :: tail => memory = value parse(tail) case Nil => } }