MapSync
classin packageklyn.collections
public class MapSync<K, V> extends Object implements MapCollection<K, V>:
└ MapSync
All Implemented Interfaces: MapCollection

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

Properties
Modifier and Type Member Description
public readonly native property size
size as ULong
Number of entries stored in the map.
Properties inherited from Object: type
Properties inherited from MapCollection: size
Constructors
Modifier and Type Member Description
public MapSync Creates an empty synchronized map.
public MapSync
MapSync(keys as IList<K>, values as IList<V>):
Creates a synchronized map from key-value pairs.
public MapSync
MapSync(map as MapCollection<K, V>):
Creates a synchronized map from another map.
Methods
Modifier and Type Member Description
public native clear
clear() as Void
Clears all entries.
public native containsValue
containsValue(value as V) as Boolean
Returns true if the value exists.
public native items
items() as IList<Tuple<K, V> >
Returns the items as a list of tuples.
public native keys
keys() as IList<K>
Returns the keys as a list.
public native remove
remove(key as K) as Boolean
Removes an entry.
public native override toString
toString() as String
Returns a normalized textual representation of map entries.
public native values
values() as IList<V>
Returns the values as a list.
Methods inherited from Object: fromJson, toDict, toJson, toString, toXml
Methods inherited from MapCollection: clear, containsValue, items, keys, remove, values
Operators
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.
Operators inherited from MapCollection: operator in(key as K) as Boolean, operator[](key as K) as V