<How create extension function ifNullOrEmpty?> I w...
# stackoverflow
u
How create extension function ifNullOrEmpty? I want to create a function like ifEmpty() of Kotlin that will also check for null: ifNullOrEmpty{ //some code if null or empty } How can i do this? And does anyone know what the code below is called? : R where C : CharSequence, C : R Example of Kotlin ifEmpty() function. @SinceKotlin("1.3") @kotlin.internal.InlineOnly public inline fun C.ifEmpty(defaultValue: () -> R): R where C : CharSequence, C : R = if (isEmpty()) defaultValue() else this Thanks and have a nice day!