Abhimanyu
11/05/2023, 2:12 AMArray<Any?>
?
fun main() {
val x: Array<Any?> = arrayOf(listOf(1, 2, 3), listOf('a', 'b', 'c'))
val y = x[0] as? List<Int> ?: emptyList()
val z = x[1] as? List<Char> ?: emptyList()
y.forEach {
println(it)
}
z.forEach {
println(it)
}
}
y
has Unchecked cast: Any? to List<Int>
and z
has Unchecked cast: Any? to List<Char>
. How to fix this properly?