mirror of
https://github.com/Smallhacker/disbrowser.git
synced 2024-06-08 05:29:34 +00:00
10 lines
330 B
Kotlin
10 lines
330 B
Kotlin
|
package com.smallhacker.disbrowser.util
|
||
|
|
||
|
typealias MultiMap<K, V> = Map<K, List<V>>
|
||
|
typealias MutableMultiMap<K, V> = MutableMap<K, MutableList<V>>
|
||
|
|
||
|
fun <K, V> mutableMultiMap(): MutableMultiMap<K, V> = HashMap()
|
||
|
|
||
|
fun <K, V> MutableMultiMap<K, V>.putSingle(key: K, value: V) {
|
||
|
computeIfAbsent(key) { ArrayList() }.add(value)
|
||
|
}
|