ObservableSet

An observable set whose read-only snapshot is available through current, with observable size and presence.

Properties

Link copied to clipboard
abstract val current: Set<T>

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.

Link copied to clipboard
abstract val size: Observable<Int>

Emits the set size whenever it changes.

Functions

Link copied to clipboard
abstract fun containsItem(item: T): Observable<Boolean>

Observes the membership status of a specific item in the set. The returned observable will emit true if the item is a member of the set, and false otherwise. Emits updates whenever the membership status changes.

Link copied to clipboard
abstract override fun dispose()

Unregisters every callback registered with this observable.

Link copied to clipboard
abstract fun <S> map(transform: (Set<T>) -> 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: (Set<T>, 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: (Set<T>) -> Unit): Disposable

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