如何将 Scala 转换Array[Int]
为 Java Integer[]
?似乎默认值是将 int 转换为int[]
,这不是定义为的方法的正确参数
public static <T extends Comparable<? super T>> T[] merge(T[] xs)
编译失败并出现以下错误
type mismatch;
found : Array[Int]
required: Array[? with Object]
Note: Int >: ? with Object, but class Array is invariant in type T.
You may wish to investigate a wildcard type such as `_ >: ? with Object`. (SLS 3.2.10)
val res = SimpleSort.merge(xs)
^