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]
?