Skip to content
RED SAGSkills
hard20 pts · first answer countsandroidkotlingenerics

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