add

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

Adds the given value to this MutableListMap.

If the given key already exists in this map, the given value will be appended to the list at that key.

Example

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

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

listMap.add(key, value)

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

Parameters

key

Key of the value to add.

value

Value to add.


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

Adds the given values to this MutableListMap.

If the given key already exists in this map, the given values will be appended to the list at that key.

Example

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

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

listMap.add(key, values)

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

Parameters

key

Key of the value to add.

values

Values to add.


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

Adds the given values to this MutableListMap.

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

Example

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

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

listMap.add(input)

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

Parameters

values

Map of values to add to this MutableListMap