Skip to content

Map

A map of keys to values.

Type parameters:

Name Upper Bound Description Default
K Any? - -
V Any? - -

Examples:

pipeline example {
    val map = {
        "a": 1,
        "b": 2,
        "c": 3
    };
}
Stub code in coreClasses.sdsstub
class Map<K, out V> {

    /**
     * Return the number of entries in the map.
     *
     * @example
     * pipeline example {
     *     val map = {
     *         "a": 1,
     *         "b": 2,
     *         "c": 3
     *     };
     *     val size = map.size(); // 3
     * }
     */
    @Pure
    @PythonMacro("len($this)")
    fun size() -> size: Int

    /**
     * Return the keys of the map.
     *
     * @example
     * pipeline example {
     *     val map = {
     *         "a": 1,
     *         "b": 2,
     *         "c": 3
     *     };
     *     val keys = map.keys(); // ["a", "b", "c"]
     * }
     */
    @Pure
    @PythonMacro("list($this.keys())")
    fun keys() -> keys: List<K>

    /**
     * Return the values of the map.
     *
     * @example
     * pipeline example {
     *     val map = {
     *         "a": 1,
     *         "b": 2,
     *         "c": 3
     *     };
     *     val values = map.values(); // [1, 2, 3]
     * }
     */
    @Pure
    @PythonMacro("list($this.values())")
    fun values() -> values: List<V>
}

keys

Return the keys of the map.

Results:

Name Type Description
keys List<K> -

Examples:

pipeline example {
    val map = {
        "a": 1,
        "b": 2,
        "c": 3
    };
    val keys = map.keys(); // ["a", "b", "c"]
}
Stub code in coreClasses.sdsstub
@Pure
@PythonMacro("list($this.keys())")
fun keys() -> keys: List<K>

size

Return the number of entries in the map.

Results:

Name Type Description
size Int -

Examples:

pipeline example {
    val map = {
        "a": 1,
        "b": 2,
        "c": 3
    };
    val size = map.size(); // 3
}
Stub code in coreClasses.sdsstub
@Pure
@PythonMacro("len($this)")
fun size() -> size: Int

values

Return the values of the map.

Results:

Name Type Description
values List<V> -

Examples:

pipeline example {
    val map = {
        "a": 1,
        "b": 2,
        "c": 3
    };
    val values = map.values(); // [1, 2, 3]
}
Stub code in coreClasses.sdsstub
@Pure
@PythonMacro("list($this.values())")
fun values() -> values: List<V>