toSet

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

Returns a new read-only set of this Optional's value if present, or otherwise an empty set. The returned set 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-set.html