getOrElse

inline fun <T> Optional<out T & Any>.getOrElse(defaultValue: () -> T): T(source)

Returns this Optional's value if present, or otherwise the result of the defaultValue function.

Since Kotlin

1.8