SplitScript reference / Map<K, V>
Map<K, V>
type constructor
Map<K where Equatable, V>
Stores an insertion-ordered association from unique keys to values.
Keys are compared with Equatable. The representation is tuned for the small and medium lookup tables common in autosplitters; no complexity guarantee is part of the API. The map retains its identity and contents across ticks, so aliases observe every mutation. Indexing returns the stored value and traps when the key is absent; use Map.containsKey first when absence is expected. This keeps maps whose values are themselves optional unambiguous without adding another lookup operation.
Examples
Store and read route metadata
let routes = Map.new<String, u32>()
routes["Atrium"] = 12
if routes.containsKey("Atrium") {
print(routes["Atrium"])
}
Methods
| Member | Description | Available through |
|---|---|---|
| clear | Removes every entry while preserving this map's identity. | |
| containsKey | Reports whether an equal key is present. | |
| insert | Inserts a key-value pair or replaces the value for an existing key. | |
| isEmpty | Reports whether this map contains no entries. | |
| iterator | Creates an insertion-order cursor over this map's entries. | |
| length | Returns the number of stored key-value pairs. | |
| new | Creates an empty map. | |
| remove | Removes the entry for a key when present. |