getOrNull

Platform and version requirements: JVM (1.7), JRE8 (1.7)
@ExperimentalStdlibApi fun <T : Any> Optional<T>.getOrNull(): T?

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

© 2010–2022 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm.optionals/java.util.-optional/get-or-null.html