'How to resort a mutableStateOf(listOf<PojoObject>())?

I have a populated:

data class PojoObject(val id: Int, val name: String)

val listData = mutableStateOf(listOf<PojoObject>())
//..
listData.value = anotherList.map{//..}

Assuming listData is already sorted by increasing id.
How can I resort the listData object by lets say name in alphabetic order?

I would prefer to operate on listItem directly without wrapping it like:

listData.value = listData.component1().map{//..}.sort{//..}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source