After a list filter, I have to cast it to the filt...
# announcements
c
After a list filter, I have to cast it to the filtered type, like
Copy code
list.filter { it is A }.forEachIndexed { index, item -> (item as A)
Is there any way to smartcast it?
g
Use
.filterIsInstance<A>()
extension instead
🙂 1
👍 2
☝️ 1
there is an issue to provide Koltin IDE plugin inspection to replace such cases with filterIsInstance()
c
thanks 🙂