Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumKotlinreified type parametersSingle-choice MCQ

What does this `reified` extension print, and why does it work where a plain generic would not?

inline fun <reified T> List<*>.firstInstanceOf(): T? { for (e in this) if (e is T) return e return null } fun main() { val xs = listOf(1, "two", 3.0, "four") println(xs.firstInstanceOf<String>()) }