如何在 Scala 中为元组创建数组?

问题描述 投票:0回答:0

我正在尝试创建一个空数组来将对象的坐标存储在元组中,然后元组存储在数组中。

当我尝试时:

var walls = Array[Tuple2]()

我收到此错误消息:

kinds of the type arguments (Tuple2) do not conform to the expected kinds of the type parameters (type T).
[error] Tuple2's type parameters do not match type T's expected parameters:
[error] class Tuple2 has two type parameters, but type T has none
[error]         var walls = Array[Tuple2]()

有没有可能这样做?

arrays scala object functional-programming scala.js
© www.soinside.com 2019 - 2024. All rights reserved.