https://kotlinlang.org logo
#announcements
Title
# announcements
t

tschuchort

06/24/2017, 6:43 PM
is there a function on collections that somehow mapsIndexed and filters at the same time? I need the indices of objects that have a specific property. I can't filter first because that would change the indices and I cant map first because then I lose the objects. Of course I could zip the objects with their original indices and then filter but I'd like to avoid that as kotlin doesn't have nice tuple syntax.
d

diesieben07

06/24/2017, 6:54 PM
tschuchort:
filterIndexed
t

tschuchort

06/24/2017, 6:55 PM
but that still returns the original object right? I need to return the index
d

diesieben07

06/24/2017, 6:58 PM
Yeah, you might need to zip then.
5 Views