错误:
Type mismatch: inferred type is Array<MutableSet<String>?> but IntArray was expected
代码:
fun tab10(): IntArray {
var Arr1 = arrayOf(player.chart_keys)
return Arr1
}
chart_keys在不同的播放器类中
var chart_keys: MutableSet<String>? = mutableSetOf(),
有可能吗?
答案 0 :(得分:3)
您需要将字符串映射到Ints,然后将Set转换为IntArray。这可能有效:
player.chart_keys?.map { it.toInt() }?.toIntArray()
?: intArrayOf()