On this page
Map<K, V>(IMap<K, V>)
package haxe.ds
Available on all platforms
Map allows key to value mapping for arbitrary value types, and many key types.
This is a multi-type abstract, it is instantiated as one of its specialization types depending on its type parameters.
A Map can be instantiated without explicit type parameters. Type inference will then determine the type parameters from the usage.
Maps can also be created with [key1 => value1, key2 => value2]
syntax.
Map is an abstract type, it is not available at runtime.
See also:
Methods
inlineclear():Void
Removes all keys from this
Map.
inlinecopy():Map<K, V>
Returns a shallow copy of this
map.
The order of values is undefined.
inlineexists(key:K):Bool
Returns true if key
has a mapping, false otherwise.
If key
is null
, the result is unspecified.
inlineget(key:K):Null<V>
Returns the current mapping of key
.
If no such mapping exists, null
is returned.
Note that a check like map.get(key) == null
can hold for two reasons:
- the map has no mapping for
key
- the map has a mapping with a value of
null
If it is important to distinguish these cases, exists()
should be used.
If key
is null
, the result is unspecified.
inlineiterator():Iterator<V>
Returns an Iterator over the values of this
Map.
The order of values is undefined.
inlinekeyValueIterator():KeyValueIterator<K, V>
Returns an Iterator over the keys and values of this
Map.
The order of values is undefined.
inlinekeys():Iterator<K>
Returns an Iterator over the keys of this
Map.
The order of keys is undefined.
inlineremove(key:K):Bool
Removes the mapping of key
and returns true if such a mapping existed, false otherwise.
If key
is null
, the result is unspecified.
inlineset(key:K, value:V):Void
Maps key
to value
.
If key
already has a mapping, the previous value disappears.
If key
is null
, the result is unspecified.
inlinetoString():String
Returns a String representation of this
Map.
The exact representation depends on the platform and key-type.
© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/haxe/ds/Map.html