conceptually is this: ``` fun <T: Any> T?.if...
# language-proposals
a
conceptually is this:
Copy code
fun <T: Any> T?.ifPresent(compute: (T) -> Unit): T? {
    if (this != null) compute(this)
    return this
}

public fun foo() {
    mapOf("to" to "2").get("to").ifPresent compute@ { tagView ->
          // I cannot return anoything but Unit because that is what my closure expects
    }
}
👍 1