<@U6PL0SPNH> Something like this? ``` val filtered...
# announcements
r
@lab Something like this?
Copy code
val filtered = (0..list.lastIndex).asSequence()
    .filter { it in indexes }
    .map(list::get)
    .toList()
(I haven't tested it)
k
If you don't care about order
val result = set.map { list[it] }.toList()
also works.
👍 1
r
Very true, and it looks a lot nicer. I've always felt using mapping functions on int ranges looks dirty.
k
And if you do care about order there's also this:
set.toList().sort().map { list[it] }
. Everything to avoid int ranges!
😆 1