1
假設我有以下代碼:類型不匹配錯誤:發現的SortedSet [INT],需要設置[INT]
case class Foo(x: SortedSet[String]) {
def bar: Set[String] = x
}
(這是實際的代碼,我的簡化。)如果我嘗試運行這,我得到以下錯誤:
error: type mismatch;
found : scala.collection.SortedSet[String]
required: Set[String]
def bar: Set[String] = x
爲什麼我得到這個錯誤?是不是SortedSet[String]
減去Set[String]
?