chickenfresh
08/24/2018, 2:09 PMmutableListOf?
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:
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:
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