Scala 如何使用字符串列表调用path.get

Scala 如何使用字符串列表调用path.get,scala,overloading,variadic-functions,Scala,Overloading,Variadic Functions,我在以下代码中有一个错误,我不明白为什么编译器在两个备选方案中都找不到好的方法: scala> import java.nio.file.Paths scala> val paths = List("a","b","c") scala> Paths.get(paths:_*) <console>:33: error: overloaded method value get with alternatives: (x$1: java.net.URI)java.n

我在以下代码中有一个错误,我不明白为什么编译器在两个备选方案中都找不到好的方法:

scala> import java.nio.file.Paths
scala> val paths = List("a","b","c")
scala> Paths.get(paths:_*)

<console>:33: error: overloaded method value get with alternatives:
  (x$1: java.net.URI)java.nio.file.Path <and>
  (x$1: String,x$2: <repeated...>[String])java.nio.file.Path
 cannot be applied to (String)
              Paths.get(paths:_*)
                ^

我的错,我认为签名是
get(String…path)
,但它是
get(String-first,String…more)
scala> Paths.get("", paths:_*)
res5: java.nio.file.Path = a/b/c
Paths.get(paths.head,paths.tail:_*)