scala 2.13:类型 IndexedSeq 采用类型参数
scala 2.13: type IndexedSeq takes type parameters
我有以下代码片段,它在 Scala 2.12 上运行良好,但在 Scala 2.13 上无法编译。
import scala.util.Random
object Hello {
def main(args: Array[String]) = {
val random = new Random()
random.shuffle[Int, IndexedSeq](2 to 100).toArray
}
}
错误是:
trait IndexedSeq takes type parameters
我不知道如何修复它。谢谢!
您可以添加所需的类型参数:
random.shuffle[Int, IndexedSeq[Int]](2 to 100).toArray
我有以下代码片段,它在 Scala 2.12 上运行良好,但在 Scala 2.13 上无法编译。
import scala.util.Random
object Hello {
def main(args: Array[String]) = {
val random = new Random()
random.shuffle[Int, IndexedSeq](2 to 100).toArray
}
}
错误是:
trait IndexedSeq takes type parameters
我不知道如何修复它。谢谢!
您可以添加所需的类型参数:
random.shuffle[Int, IndexedSeq[Int]](2 to 100).toArray