AFAIK, GenTraversableOnce
is the most general collection type, so I should prefer it over more specific collection types in APIs. However, I don't think is a subtype of Serializable
.
If I have
case class(name: String, items: TYPE) extends Serializable
what should TYPE
be in order to be the most general?
AFAIK, only concrete classes like List
extend Serializable
in the collections API. However, you can use the compound type GenTraversableOnce[_] with Serializable
:
case class(name: String, items: GenTraversableOnce[_] with Serializable) extends Serializable