AbstractJsMap

sealed class AbstractJsMap<K : Any, V> : MapLike<K, V>

JS: Abstract Map

Implements baseline Map-like functionality for JavaScript-compatible map structures. This is the top-most class for all custom JS map implementations provided by Elide. Specialized sub-classes are available for maps with mutability, sorted entries, multi-value entries, and threadsafe access. Each is backed by an equivalent Java map, with JavaScript map methods mapped to equivalent Java map methods.

Mutability

By default, maps which adhere to this interface are non-mutable. BaseMutableJsMap implements the mutability methods and provides an equivalent top-abstract-base.

Sorting

Since the structure of JS-provided map classes is like a giant Russian doll toy (with all map types extending this one, and so on), it is entirely possible to represent sorted maps as regular JsMap or AbstractJsMap instances. By keeping a type which adheres to JsSortedMap, the developer knows that the map is sorted, and can rely on the internal map state reflecting that.

Concurrency

Thread-safe maps are available where the underlying Java map is thread-safe. Concurrent maps should not usually be necessary when interfacing with JS code, since JS execution is inherently single-threaded in almost all cases. If, however, you are doing work in the background (in another thread) with a map that is exposed to JavaScript, a thread safe map can make sure both views of the backing data are consistent.

Parameters

K

Key type for the map. Keys cannot be null.

V

Value type for the map. Values can be null.

sorted

Whether the map implementation holds a sorted representation.

mutable

Whether the map implementation is mutable.

multi

Whether the map implementation allows multiple values per key.

threadsafe

Whether the map implementation is thread-safe.

Inheritors

Properties

Link copied to clipboard
abstract val entries: Set<Map.Entry<K, V>>
Link copied to clipboard
abstract val keys: Set<K>
Link copied to clipboard
abstract val size: Int
Link copied to clipboard
abstract val values: Collection<V>

Functions

Link copied to clipboard
abstract fun containsKey(key: K): Boolean
Link copied to clipboard
abstract fun containsValue(value: V): Boolean
Link copied to clipboard
abstract fun entries(): JsIterator<MapLike.Entry<K, V>>

TBD.

Link copied to clipboard
abstract fun forEach(op: (MapLike.Entry<K, V>) -> Unit)

TBD.

Link copied to clipboard
abstract operator override fun get(key: K): V?

TBD.

Link copied to clipboard
abstract fun has(key: K): Boolean

TBD.

Link copied to clipboard
abstract fun isEmpty(): Boolean
Link copied to clipboard
abstract fun keys(): JsIterator<K>

TBD.

Link copied to clipboard
abstract override fun toString(): String

TBD.

Link copied to clipboard
abstract fun values(): JsIterator<V>

TBD.