spand
09/18/2019, 9:08 AMList<E>.associateWithIndex(): Map<E, Int>
or something similar that I am missing. (edited)mister11
09/18/2019, 9:36 AMmapWithIndex
, filterWithIndex
, forEachWithIndex
and maybe some more to do some processing.mister11
09/18/2019, 9:36 AMmapWithIndex
that will map item + index in some model (or Pair if that's good enough)spand
09/18/2019, 9:38 AM.indexed().associateBy({ it.value }) { it.index }
. I just kind of expected it to be there but wasnt sure about the namearekolek
09/18/2019, 10:24 AM.mapIndexed(::Pair).toMap()
although now I see you want a map of values to indices
so that would have to be .mapIndexed { i, v -> v to i }.toMap()