Sam
03/06/2023, 10:27 PMCLOVIS
03/06/2023, 10:33 PMabstract class Foo {
abstract val name: String
init {
require(name.length < 20)
}
}
class FooImpl(override val name: String) : Foo()
CLOVIS
03/06/2023, 10:34 PMStephan Schröder
03/06/2023, 11:09 PMval listOfLists = listOf(listOf(1))
val values = listOfLists.filterIsInstance<List<String>>()
println("Values: $values")
println(values[0][0].uppercase())
leading to
Values: [[1]]
Exception in thread "main" java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.String
type erasure at its finest.