Add sample for orEmpty method

This commit is contained in:
Yuki Miida
2018-09-16 19:45:49 +09:00
committed by ilya-g
parent 64b23812c0
commit af1fc5b668
2 changed files with 11 additions and 0 deletions
@@ -158,6 +158,8 @@ public inline fun <K, V> Map<out K, V>?.isNullOrEmpty(): Boolean {
/**
* Returns the [Map] if its not `null`, or the empty [Map] otherwise.
*
* @sample samples.collections.Maps.Usage.mapOrEmpty
*/
@kotlin.internal.InlineOnly
public inline fun <K, V> Map<K, V>?.orEmpty(): Map<K, V> = this ?: emptyMap()