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

com.jtransc.lang.MapExt.kt Maven / Gradle / Ivy

package com.jtransc.lang

import java.util.*

fun  HashMap.putIfAbsentJre7(key: K, value: V): V? = if (!containsKey(key)) put(key, value) else get(key)

fun  Map>.mergeMapListWith(other: Map>): Map> {
	val first = this
	val second = other
	return (this.keys + other.keys).distinct().map {
		it to ((first[it] ?: listOf()) + (second[it] ?: listOf()))
	}.toMap()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy