mutable

fun <T> T.mutable(onChange: suspend (old: T, new: T) -> Unit = { _, _ -> }): Mutable<T>(source)

将一个不可变数据包装为可变数据,并提供并发安全的更新方式。

请不要对 MutableCollection 这类本身可变的数据调用 mutable

Parameters

onChange

当数据被修改后执行的 lambda。

Throws


Deprecated (with error)

Already a Mutable object. Avoid nesting.

尽可能地在编译器拦截对 Mutablemutable 调用,前提是匹配到此重载。


Deprecated (with error)

Already a Mutable object. Avoid nesting.

尽可能地在编译器拦截对 MutableCollectionmutable 调用,前提是匹配到此重载。


Deprecated (with error)

Already a Mutable object. Avoid nesting.

尽可能地在编译器拦截对 MutableMapmutable 调用,前提是匹配到此重载。