external class Map<out Key, out Value> extends Any
A mapping from keys to values.
Known subtypes:
Known usages:
All versions:
Maps retain the order of entries when constructed, which affects the how they are iterated
over.
However, ordering of entries does not affect equality between two maps.
The following operators are supported for maps:
map[key] // subscript; similar to `getOrNull` but throws if key not found
map1 + map2 // merge; if both maps have an entry with the same key, the entry in map2 wins
Converts this map to a typed object of class clazz.
Conforms to the semantics of the following manual conversion:
class Person { name: String; age: Int }
map = Map(name, "Pigeon", age, 42)
function toTyped(map: Map): Person = new {
name = map.getOrNull("name") ?? super.name
age = map.getOrNull("age") ?? super.age
}
Notable behavior:
Entries of this that have no corresponding property in clazz are ignored.
clazz properties that have no corresponding entry in this have their defaults preserved.
clazz properties that have neither a default nor a corresponding entry in this
throw an "undefined property" error (only) when accessed.
Throws if clazz is abstract or not a subclass of Typed.
A mapping from keys to values.