orEmpty
Returns the array if it's not null, or an empty array otherwise.
Since Kotlin
1.0Samples
import kotlin.test.*
fun main() {
//sampleStart
val nullArray: Array<Any>? = null
println(nullArray.orEmpty().contentToString()) // []
val array: Array<Char>? = arrayOf('a', 'b', 'c')
println(array.orEmpty().contentToString()) // [a, b, c]
//sampleEnd
}