orDefault

inline fun <T> Collection<T>?.orDefault(default: Collection<T>?): Collection<T>

Returns this collection if it is not null and not empty, or the specified default collection otherwise.

Return

this collection if it is not null and not empty, or the default collection otherwise.

Parameters

default

the collection to return if this collection is null or empty.


inline fun <K, V> Map<K, V>?.orDefault(default: Map<K, V>?): Map<K, V>

Returns this map if it is not null and not empty, or the specified default map otherwise.

Return

this map if it is not null and not empty, or the default map otherwise.

Parameters

default

the map to return if this map is null or empty.