Skip to content
RED SAG Skills
hardStudy question · answer published in Kotlin interview questions, so no pointsandroidkotlingenerics

Checking a generic type at runtime

Why does this function need inline and reified?

inline fun <reified T> List<Any>.firstOfType(): T? =
    firstOrNull { it is T } as T?
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions