toList

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

fun <T : Any> Optional<out T>.toList(): List<T>(source)
import java.util.Optional

fun main() {
    val present: Optional<String> = Optional.of("kotlin")
    val absent: Optional<String>   = Optional.empty()

    println(present.toList())   // prints: [kotlin]
    println(absent.toList())    // prints: []
}

Source