getOrDefault

fun <T> Optional<out T & Any>.getOrDefault(defaultValue: T): T(source)

Returns this Optional's value if present, or otherwise defaultValue.

Since Kotlin

1.8