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

commonMain.com.github.insanusmokrassar.TelegramBotAPI.utils.Map.kt Maven / Gradle / Ivy

package com.github.insanusmokrassar.TelegramBotAPI.utils

fun  mapOfNotNull(vararg pairs: Pair): Map {
    return HashMap().apply {
        pairs.forEach {
            (key, value) ->
            value ?.also {
                put(key, it)
            }
        }
    }
}

fun  Map.mapNotNullValues(): Map = asSequence().mapNotNull {
    it.value ?.let { value ->
        it.key to value
    }
}.toMap()




© 2015 - 2024 Weber Informatics LLC | Privacy Policy