toList

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

Returns a new read-only list of this Optional's value if present, or otherwise an empty list. The returned list is serializable (JVM).

© 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/to-list.html