Is Array[String] not a subclass of Seq[String] in Scala?

Viewed 1027

I wrote a method that accepts objects of all subclasses of Seq[String]. Unfortunately it won't accept an object of the type Array[String]. Is Array[String] not a subclass of Seq[String]?

scala> def test[T <: Seq[String]](x: T) = {}
test: [T <: Seq[String]](x: T)Unit

scala> val data = "This is a test string"
data: java.lang.String = This is a test string

scala> test(data.split(" "))
<console>:10: error: inferred type arguments [Array[java.lang.String]] do not conform to method test's type parameter bounds [T <: Seq[String]]
              test(data.split(" "))
2 Answers
Related