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

Properties

Link copied to clipboard
abstract override val size: Int

Functions

Link copied to clipboard
open fun addChangeListener(lambda: (set: ObservableSet<E>, change: SetChange<E>) -> Unit): SetChangeListener<E>
abstract fun addChangeListener(listener: SetChangeListener<E>)
Link copied to clipboard
abstract fun addListener(listener: InvalidationListener)
Link copied to clipboard
open fun addWeakChangeListener(lambda: (set: ObservableSet<E>, change: SetChange<E>) -> Unit): SetChangeListener<E>
Link copied to clipboard
Link copied to clipboard
fun <T> Set<T>.asReadOnly(): Set<T>

Wraps the Set with a lightweight delegating class that prevents casting back to mutable type

Link copied to clipboard
abstract operator override fun contains(element: E): Boolean
Link copied to clipboard
abstract override fun containsAll(elements: Collection<E>): Boolean
Link copied to clipboard
abstract override fun isEmpty(): Boolean
Link copied to clipboard
Link copied to clipboard
abstract operator override fun iterator(): Iterator<E>
Link copied to clipboard
abstract fun removeChangeListener(listener: SetChangeListener<E>)
Link copied to clipboard
abstract fun removeListener(listener: InvalidationListener)
Link copied to clipboard