Join Slack
Powered by
<passing array to functional interface but get (Ar...
# stackoverflow
u
user
07/14/2022, 8:11 AM
passing array to functional interface but get (Array<out TypeVariable(T)>) -> Array<out TypeVariable(T)>? type mismatch
val changeFirstElement = VarargsFunction { ss: Array -> ss[0] = ss[0]!! + " world" ss } val params = arrayOf("hello") } fun interface VarargsFunction { fun apply(vararg t: T): Array? } I get this following exception: Type mismatch: inferred type is (Array) -> Array? but (Array) -> Array? was expected Any suggestion why is this exception and how to resolve it? Thanks Playground link
https://pl.kotl.in/kBwQZlCZj
6
Views
Open in Slack
Previous
Next