Package-level declarations

Convenience extension functions for java.util.Optional to simplify Kotlin-Java interop.

Functions

Link copied to clipboard

Returns a new sequence for this Optional's value if present, or otherwise an empty sequence. The returned set is serializable (JVM).

Since Kotlin 1.7
Link copied to clipboard
fun <R, T : R & Any> Optional<T>.getOrDefault(defaultValue: R): R

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

Since Kotlin 1.7
Link copied to clipboard
inline fun <R, T : R & Any> Optional<T>.getOrElse(defaultValue: () -> R): R

Returns this Optional's value if present, or otherwise the result of the defaultValue function.

Since Kotlin 1.7
Link copied to clipboard

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

Since Kotlin 1.7
Link copied to clipboard

Appends this Optional's value to the given destination collection if present.

Since Kotlin 1.7
Link copied to clipboard

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

Since Kotlin 1.7
Link copied to clipboard

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

Since Kotlin 1.7