Taking your suggestion and codifying it (not teste...
# stdlib
r
Taking your suggestion and codifying it (not tested yet):
Copy code
fun <T> List<T>.filterIsInstanceIndexed(): List<IndexedValue<T>> = 
  mapIndexed {i, v -> Pair(i, v)}.filter { it.second is T }.map { IndexedValue(it.first, it.second) }