I can't overload a `vararg` function with an `Arra...
# getting-started
f
I can't overload a
vararg
function with an
Array
of the same type because the vararg is internally represented as an array on the JVM? (I know I can use the spread operator)
k
Yes, as a workaround you could maybe use
@JvmName
, but don't.
f
thanks
is it impossible to pass a (spreaded)
Array<Int>
to
varargs x: Int
?
seems like it only accepts
IntArray
are there no use cases for varargs of box types?
I guess it doesnt matter since you can always convert it
k
I think it has to do with Java compatibility, where
int...
is
int[]
and not
Integer[]
. But like you said, it's not a big problem.
f
yea seems like it always has to be converted to IntArray