All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.phraseapp.extensions.MapExtensions.kt Maven / Gradle / Ivy

The newest version!
package phraseapp.extensions

fun  Iterable>.associateWithList(): Map> {
    val map = mutableMapOf>()
    forEach {
        if (map.containsKey(it.first)) {
            val list = map[it.first]!!
            list.add(it.second)
            map.replace(it.first, list)
        } else {
            map[it.first] = arrayListOf(it.second)
        }
    }
    return map
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy