ObservableSet

interface ObservableSet<E> : Set<E> , Observable

A set, which can be observed by SetChangeListeners and InvalidationListeners.

Note, the collection names in Glok use Kotlin's naming convention. So an ObservableSet is not mutable, whereas MutableObservableSet is.

Comparing Glok with JavaFX :

  • Glok : ObservableSet <-> JavaFX : ReadOnlyObservableSet

  • Glok : MutableObservableSet <-> JavaFX : ObservableSet

The easiest way to create a MutableObservableSet is to wrap an existing (non-observable) set using asMutableObservableList :

val myObservableSet = myMutableSet.asObservableSet()

Afterwards, you should never modify myMutableSet directly, as those changes will not be heard by any SetChangeListeners, or InvalidationListeners.

For a class diagram, see ObservableList, and replace List with Set. The structure is identical.

Inheritors

Functions

Link copied to clipboard
open fun addChangeListener(lambda: (list: ObservableSet<E>, change: SetChange<E>) -> Unit): SetChangeListener<E>
abstract fun addChangeListener(listener: SetChangeListener<E>)
Link copied to clipboard
open fun addWeakChangeListener(lambda: (list: ObservableSet<E>, change: SetChange<E>) -> Unit): SetChangeListener<E>
Link copied to clipboard
Link copied to clipboard
abstract fun removeChangeListener(listener: SetChangeListener<E>)
Link copied to clipboard