Suppose I have the following code:
case class Foo(x: SortedSet[String]) {
def bar: Set[String] = x
}
(This is a simplification of the actual code I have.) If I try to run this, I get the following error:
error: type mismatch;
found : scala.collection.SortedSet[String]
required: Set[String]
def bar: Set[String] = x
Why do I get this error? Isn’t SortedSet[String] a subtrait of Set[String]?
Set is immutable.Set.