Is there simple function of this? ```list.lastOrNu...
# codereview
z
Is there simple function of this?
Copy code
list.lastOrNull { it is Goods } as? Goods
I just made this one
Copy code
inline fun <reified T> Collection<*>.findFirstInstance(): T? = firstOrNull { it is T } as? T

inline fun <reified T> Collection<*>.findLastInstance(): T? = lastOrNull { it is T } as? T
p
Should be out T instead of star projection
Also as T?, not as? T