IViewableMap

interface IViewableMap<K : Any, out V : Any> : Map<K, V> , IViewable<Map.Entry<K, V>> , ISource<IViewableMap.Event<K, V>>

A map allowing its contents to be observed.

Types

Link copied to clipboard
sealed class Event<K, out V>

Represents an addition, update or removal of an element in the map.

Functions

Link copied to clipboard
abstract fun advise(lifetime: Lifetime, handler: (IViewableMap.Event<K, V>) -> Unit)

Adds an event subscription. Every time an event occurs, the handler is called, receiving an instance of the event. The subscription is removed when the given lifetime expires.

Link copied to clipboard
open fun adviseAddRemove(lifetime: Lifetime, handler: (AddRemove, K, V) -> Unit)

Adds a subscription to additions and removals of map elements. When a map element is updated, the handler is called twice: to report the removal of the old element and the addition of the new one.

Link copied to clipboard
abstract fun containsKey(key: K): Boolean
Link copied to clipboard
abstract fun containsValue(value: V): Boolean
Link copied to clipboard
open fun forEach(p0: BiConsumer<in K, in V>)
Link copied to clipboard
abstract operator fun get(key: K): V?
Link copied to clipboard
open fun getOrDefault(key: K, defaultValue: V): V
Link copied to clipboard
abstract fun isEmpty(): Boolean
Link copied to clipboard
open override fun view(lifetime: Lifetime, handler: (Lifetime, Map.Entry<K, V>) -> Unit)

Adds a subscription to changes of the contents of the map.

open fun view(lifetime: Lifetime, handler: (Lifetime, K, V) -> Unit)

Adds a subscription to changes of the contents of the map, with the handler receiving keys and values as separate parameters.

Properties

Link copied to clipboard
abstract val change: ISource<IViewableMap.Event<K, V>>
Link copied to clipboard
abstract val entries: Set<Map.Entry<K, V>>
Link copied to clipboard
abstract val keys: Set<K>
Link copied to clipboard
abstract val size: Int
Link copied to clipboard
abstract val values: Collection<V>

Inheritors

Link copied to clipboard
Link copied to clipboard

Extensions

Link copied to clipboard
fun <K : Any, V : Any> IViewableMap<K, V>.createIsEmpty(lifetime: Lifetime): IPropertyView<Boolean>
fun <K : Any, V : Any> IViewableMap<K, V>.createIsEmpty(): IPropertyView<Boolean>
Link copied to clipboard
fun <K : Any, V : Any> IViewableMap<K, V>.createIsNotEmpty(lifetime: Lifetime): IPropertyView<Boolean>
fun <K : Any, V : Any> IViewableMap<K, V>.createIsNotEmpty(): IPropertyView<Boolean>