public class MapSync<K, V> extends Object implements MapCollection<K, V>:
Thread-safe balanced binary tree map.
MapSync<K, V> exposes the same typed API as Map<K, V> while the native runtime serializes operations on the instance storage. Keys stay typed as K and values stay typed as V throughout the public API.
Prefer Map<K, V> for single-threaded hot paths. Use this class when shared mutable access from several threads is required.
@param <K> Key type. @param <V> Value type. @since 1.0
| Modifier and Type | Member | Description |
|---|---|---|
| public readonly native property | sizesize as ULong |
Number of entries stored in the map. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | MapSyncMapSync(): |
Creates an empty synchronized map. |
| public | MapSync | Creates a synchronized map from key-value pairs. |
| public | MapSyncMapSync(map as MapCollection<K, V>): |
Creates a synchronized map from another map. |
| Modifier and Type | Member | Description |
|---|---|---|
| public native | clearclear() as Void |
Clears all entries. |
| public native | containsValuecontainsValue(value as V) as Boolean |
Returns true if the value exists. |
| public native | items | Returns the items as a list of tuples. |
| public native | keyskeys() as IList<K> |
Returns the keys as a list. |
| public native | removeremove(key as K) as Boolean |
Removes an entry. |
| public native override | toStringtoString() as String |
Returns a normalized textual representation of map entries. |
| public native | valuesvalues() as IList<V> |
Returns the values as a list. |
| Modifier and Type | Member | Description |
|---|---|---|
| public native | operator in(key as K) as Boolean | Returns true if the key exists. |
| public native | operator[](key as K) as V | Gets or sets the value associated with the key. |