orEmpty

inline fun <T> Collection<T>?.orEmpty(): Collection<T>(source)

Returns this Collection if it's not null and the empty list otherwise.

Since Kotlin

1.0

Samples


inline fun <T> List<T>?.orEmpty(): List<T>(source)

Returns this List if it's not null and the empty list otherwise.

Since Kotlin

1.0

Samples


inline fun <K, V> Map<K, V>?.orEmpty(): Map<K, V>(source)

Returns the Map if its not null, or the empty Map otherwise.

Since Kotlin

1.0

Samples


inline fun <T> Set<T>?.orEmpty(): Set<T>(source)

Returns this Set if it's not null and the empty set otherwise.

Since Kotlin

1.0

expect inline fun <T> Array<out T>?.orEmpty(): Array<out T>(source)

Returns the array if it's not null, or an empty array otherwise.

Since Kotlin

1.0

Samples

actual inline fun <T> Array<out T>?.orEmpty(): Array<out T>(source)

Returns the array if it's not null, or an empty array otherwise.

Since Kotlin

1.1

Samples

actual inline fun <T> Array<out T>?.orEmpty(): Array<out T>(source)

Returns the array if it's not null, or an empty array otherwise.

Since Kotlin

1.0

Samples

actual inline fun <T> Array<out T>?.orEmpty(): Array<out T>(source)

Returns the array if it's not null, or an empty array otherwise.

Since Kotlin

1.3

Samples