Extensions for java.util.Optional
Platform and version requirements: JVM (1.8), JRE8 (1.8)
Returns this Optional's value if present, or otherwise defaultValue.
fun <T> Optional<out T>.Any()
Platform and version requirements: JVM (1.8), JRE8 (1.8)
Returns a new sequence for this Optional's value if present, or otherwise an empty sequence.
fun <T : Any> Optional<out T>.asSequence(): Sequence<T>
Platform and version requirements: JVM (1.8), JRE8 (1.8)
Returns this Optional's value if present, or otherwise null.
fun <T : Any> Optional<T>.getOrNull(): T?
Platform and version requirements: JVM (1.8), JRE8 (1.8)
Appends this Optional's value to the given destination collection if present.
fun <T : Any, C : MutableCollection<in T>> Optional<T>.toCollection(
destination: C
): C
Platform and version requirements: JVM (1.8), JRE8 (1.8)
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>
Platform and version requirements: JVM (1.8), JRE8 (1.8)
Returns a new read-only set of this Optional's value if present, or otherwise an empty set. The returned set is serializable (JVM).
fun <T : Any> Optional<out T>.toSet(): Set<T>