public class HashMapSync<K, V> extends Object implements Map<K, V>:
Thread-safe hash map implementation.
HashMapSync<K, V> exposes the same typed API as HashMap<K, V> and uses the hash-backed native runtime path with synchronized instance storage. Average add, lookup and remove remain O(1), with the expected lock overhead for shared mutable access. Iteration follows the hash table's internal bucket traversal and has no insertion-order guarantee.
values = s:{"answer": 42}
assert values is HashMapSync<String, Int>| Modifier and Type | Member | Description |
|---|---|---|
| public readonly native property | sizesize as ULong |
Gets the number of entries stored in this synchronized hash map. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | HashMapSyncHashMapSync(): |
Creates an empty synchronized hash map. |
| public | HashMapSyncHashMapSync(keys as IList<K>, values as IList<V>): |
Creates a synchronized hash map from key-value pairs. |
| public | HashMapSyncHashMapSync(map as Map<K, V>): |
Creates a synchronized hash map from another map. |
| Modifier and Type | Member | Description |
|---|---|---|
| public native | clearclear() as Void |
Removes every entry. |
| public native | containsValuecontainsValue(value as V) as Boolean |
Returns true if an entry contains the requested value. |
| public | getget<R>(key as K, defaultValue as R) as R: |
Returns the associated value or a typed default when the key is absent. |
| public native | items | Returns key-value tuples as a list. |
| 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 the s:{...} representation of the 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 a key. |