kef
07/20/2018, 4:00 PMcategories: Map<Int, Int>
with key being category id, and value being id of a parent. For any given category I want to find full path, till parent id = 0. My current solution is kinda ugly:
var id: Int = categoryId
val path = mutableListOf<Int>()
do {
path.add(id)
id = categories[id]!!
} while (id != 0)
How can I write this better, without yield?