actually <@U3W1E2Y00> here’s 2 non-casting solutio...
# getting-started
g
actually @henrik here’s 2 non-casting solutions:
Copy code
fun foo() : Map<String, String> {
    return mapOf("a" to null, "b" to "foo")
            .mapNotNull { entry -> entry.value?.let { entry.key to it } }
            .toMap()
}

fun blah() : Map<String, String> {
    return mapOf("a" to null, "b" to "foo")
            .filter{ it.value != null }
            .mapValues { it.value!! }
}
👍 1