# State

class State(initialState: Map<String, Any> = emptyMap(), initialDelta: Map<String, Any> = emptyMap()) : Map<String, Any>

A thread-safe state map that maintains the current value and tracks modifications.

This class implements Map to provide a read-only view of the state, while exposing specific mutation methods (set, putAll).

## Constructors

State
Link copied to clipboard
constructor(initialState: Map<String, Any> = emptyMap(), initialDelta: Map<String, Any> = emptyMap())

## Types

Companion
Link copied to clipboard
object Companion

## Properties

entries
Link copied to clipboard
open override val entries: Set<Map.Entry<String, Any>>
hasDelta
Link copied to clipboard
val hasDelta: Boolean

Whether the state has pending delta.

keys
Link copied to clipboard
open override val keys: Set<String>
size
Link copied to clipboard
open override val size: Int
values
Link copied to clipboard
open override val values: Collection<Any>

## Functions

applyDelta
Link copied to clipboard
fun applyDelta(delta: Map<String, Any>)

Applies a delta to the state and tracks it in the delta map.

clear
Link copied to clipboard
fun clear()

Clears the state and delta maps.

containsKey
Link copied to clipboard
open override fun containsKey(key: String): Boolean
containsValue
Link copied to clipboard
open override fun containsValue(value: Any): Boolean
get
Link copied to clipboard
open operator override fun get(key: String): Any?
isEmpty
Link copied to clipboard
open override fun isEmpty(): Boolean
putAll
Link copied to clipboard
fun putAll(from: Map<out String, Any>)

Updates the state with all entries from the given map.

remove
Link copied to clipboard
fun remove(key: String): Any?
set
Link copied to clipboard
operator fun set(key: String, value: Any): Any?

Sets the value for the given key.

toString
Link copied to clipboard
open override fun toString(): String