set

abstract fun set(key: K, value: V)

Sets the given value to this MutableListMap.

If the given key already exists in this map it will be overwritten with a new list containing only the given value.

Example

listMap == {
"foo" = ["bar", "fizz", "buzz"]
}

key == "foo"
value == "happy"

listMap.add(key, value)

listMap == {
"foo" = ["happy"]
}

Parameters

key

Key of the value to add.

value

Value to add.


abstract fun set(key: K, vararg values: V)

Sets the given values to this MutableListMap.

If the given key already exists in this map, it will be overwritten with the given array of values.

Example

listMap == {
"foo" = ["bar", "fizz", "buzz"]
}

key == "foo"
values == ["happy", "sad"]

listMap.add(key, values)

listMap == {
"foo" = ["happy", "sad"]
}

Parameters

key

Key of the value to add.

values

Values to add.


abstract fun set(key: K, values: Iterable<V>)

Sets the given values to this MutableListMap.

If the given key already exists in this map, it will be overwritten with the given collection of values.

Example

listMap == {
"foo" = ["bar", "fizz", "buzz"]
}

key == "foo"
values == ["happy", "sad"]

listMap.add(key, values)

listMap == {
"foo" = ["happy", "sad"]
}

Parameters

key

Key of the value to add.

values

Values to add.


abstract fun set(values: Map<K, Iterable<V>>)

Sets the given values to this MutableListMap.

If any key in the given Map overlaps with a key in this MutableListMap, the values in this MutableListMap will be replaced by value in the input map the list at the overlapping key.

Example

listMap == {
"foo" = ["bar", "fizz", "buzz"]
}

input == {
"foo" = ["happy", "sad"]
}

listMap.add(input)

listMap == {
"foo" = ["happy", "sad"]
}

Parameters

values

Map of values to add to this MutableListMap