Mutable

class Mutable<T>(var value: T)

Support explicit mutable wrapping of variables. This is used specifically for allowing non-final variables to be used by inner classes. The uses were generated automatically by the Smalltalk → Java translator after flow analysis.

Author

Mark van Gulik

Parameters

T

The type of mutable object.

value

The initial value.

Constructors

Link copied to clipboard
fun <T> Mutable(value: T)

Constructor that takes an initial value.

Functions

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
inline fun update(updater: T.() -> T)

Update the Mutable via an extension function. Within the function, the receiver will be the old value of the Mutable, and the function must return a replacement value.

Properties

Link copied to clipboard
var value: T

Expose a public field for readability.