jean
12/21/2025, 9:30 PMMap<Int, Pair<String, Role>> that I want to update with a new pair at a given index. I have this code but I feel like one could do better. How would you implement it?
private fun CompanyState.updateEmployees(
index: Int,
newValue: (Pair<String, Role>) -> Pair<String, Role>
): AddSceneState {
val pair = employees[index] ?: return this
val editableMap = employees.toMutableMap()
editableMap[index] = newValue(pair)
return copy(creatives = editableMap)
}loke
12/22/2025, 4:27 AM