elect
07/03/2024, 4:05 PMJoffrey
07/03/2024, 4:08 PMmapIndexedNotNull
like this:
val indicesOfMatches = items.mapIndexedNotNull { i, elt -> i.takeIf { predicate(elt) }}
elect
07/03/2024, 4:09 PMmapIndexedNotNull
on FloatArray
..Klitos Kyriacou
07/03/2024, 4:25 PMmyPrimitiveArray.asList().mapIndexedNotNull
. This avoids creating a whole List
but has the overhead of boxing each element as it iterates through the array.