ObservableMap

interface ObservableMap<K, V> : Observable<Map<K, V>> (source)

An observable map whose read-only snapshot is available through current. Values can be observed by key through get.

Type Parameters

K

The type of keys maintained by the map.

V

The type of mapped values.

Properties

Link copied to clipboard
abstract val current: Map<K, V>

The current state or value of the observable.

Link copied to clipboard

Whether any callback is currently registered.

Link copied to clipboard
abstract val observerCount: Int

How many callbacks are currently registered.

Functions

Link copied to clipboard
abstract override fun dispose()

Unregisters every callback registered with this observable.

Link copied to clipboard
abstract operator fun get(key: K): Observable<Option<V>>

Retrieves the observable representation of the value associated with the specified key in the observable map. The resulting observable emits updates whenever the value for the given key changes, is added, or is removed.

Link copied to clipboard
abstract fun <S> map(transform: (Map<K, V>) -> S): Observable<S>

Transforms the current observable into a new observable by applying the specified transformation function to its emitted values.

Link copied to clipboard
abstract fun <O, R> mergeWith(other: Observable<O>, merge: (Map<K, V>, O) -> R): Observable<R>

Combines the current observable with another observable, producing a new observable that emits values derived by applying the provided merge function to the current values of both observables.

Link copied to clipboard
abstract fun onChange(notifyOnRegistration: Boolean = true, callback: (Map<K, V>) -> Unit): Disposable

Registers callback to be invoked with every new value of this observable, and right away with the current one if notifyOnRegistration.