package application.model import kotlin.properties.Delegates class ObservableVessel { val listeners: MutableList = mutableListOf() var vessels: MutableMap by Delegates.observable( initialValue = mutableMapOf(), onChange = { _, _, new -> run { observableSelectedVessel.vessel = Vessel(null) listeners.forEach { it.onValueChanged(new) } } } ) }