<@U25U0KPFT> I’m receiving objects from server (pa...
# tornadofx
c
@carlw I’m receiving objects from server (parsing from json to data class), you’d offer using
mutableListOf
? I have this for now:
val itemsList = FXCollections.observableArrayList<SingleKindModel>()
thats how my
itemlist
looks like, on selection I’m using this:
curSelectedItem.value = itemsList.find { it.id == itemid }
it works good with this model:
Copy code
class SingleKindModel(val id: Int) {
    constructor(item: Item) : this(
            item.id)
}
but I wanna use another-kind-models in a same list, so new class looks like this in my case:
Copy code
sealed class ItemViewInstance {
    data class Item1(val item1: SingleKindModel): ItemViewInstance()
    data class Item2(val item2: SecondKindModel): ItemViewInstance()
}
so
SingleKindModel
in
itemsList
changes to
ItemViewInstance
and
itemsList.find { it.id == itemid }
no longer works