```val componentArgs: List<Pair<Int, Compone...
# announcements
k
Copy code
val componentArgs: List<Pair<Int, Component>> = args
        .mapIndexed { idx, it -> idx to it }
        .filter { it.second is Component }
        .map { it.first to it.second as Component }
Is there a neater way of writing this? I want to store index to args value only if it is Component Thread in Slack Conversation Assuming it's something like
List<Any>
this should work:
Copy code
val componentArgs = args
    .filterIsInstance(Component::class)
    .mapIndexed(::Pair)
Where that last line in synthatic sugar for
{idx, it -> idx to it}
.