我知道如何定义一个带有可变长度参数的方法:
case class taxonomy(vocabularies:(String,Set[String])*)
Run Code Online (Sandbox Code Playgroud)
和客户端代码非常干净:
val terms=taxonomy("topics"->Set("economic","politic")
,"tag"->Set("Libya","evolution")
)
Run Code Online (Sandbox Code Playgroud)
但我想知道当我有一个变量(而不是变量序列)时,我如何使用这个案例类,如下所示:
val notFormattedTerms = Map("topics"->Set("economic","politic")
,"tag"->Set("Libya","evolution"))
Run Code Online (Sandbox Code Playgroud) scala ×1