Map
Map
A map container backed by either a hash map or a linked hash map.
Map type
map<KeyType, ValueType>
Subtypes | Supertypes | Comparable types |
---|---|---|
sorted_map<KeyType, ValueType> | sequence< mapping<KeyType, ValueType> > | java.util.Map<KeyType, ValueType> |
The map type is retrofitted to be a subtype of sequence
.
Map creation
new hashmapnew linked_hashmap
Parameter type | Result type |
---|---|
(KeyType => ValueType)... | map<KeyType, ValueType> |
Creates an empty map. Optionally, initial values may be specified right in the new map creation expression.
Operations on map
get value by key
Operand type | Parameter type | Result type |
---|---|---|
map<KeyType, ValueType> | KeyType | ValueType |
keys
Operand type | Parameter type | Result type |
---|---|---|
map<KeyType, ValueType> | none | sequence<KeyType> |
Results in a sequence containing all the keys in the map.
containsKey
Operand type | Parameter type | Result type |
---|---|---|
map<KeyType, ValueType> | KeyType | boolean |
Returns true if the map contains a mapping for the specified key, false otherwise.
values
Operand type | Parameter type | Result type |
---|---|---|
map<KeyType, ValueType> | none | sequence<ValueType> |
Results in a sequence containing all the values in the map.
containsValue
Operand type | Parameter type | Result type |
---|---|---|
map<KeyType, ValueType> | ValueType | boolean |
Returns true if the map contains a mapping with the specified value, false otherwise.
mappings
Operand type | Parameter type | Result type |
---|---|---|
map<KeyType, ValueType> | none | set< mapping<KeyType, ValueType> > |
Results in a set of mappings contained by this map. The mappings can be removed from the set, but not added.
assign value to a key
Operand type | Parameter type | Result type |
---|---|---|
map<KeyType, ValueType> | KeyType | ValueType |
remove
Operand type | Parameter type | Result type |
---|---|---|
map<KeyType, ValueType> | KeyType | void |
Removes the specified key and the associated value from the map.
clear
Operand type | Parameter type | Result type |
---|---|---|
map<KeyType, ValueType> | none | void |
Clears all key-value pairs from the map.
putAll
Operand type | Parameter type | Result type |
---|---|---|
map<KeyType, ValueType> | map<KeyType, ValueType> | void |
Puts all mappings from the map specified as a parameter into this map, replacing existing mappings.