I can\'t figure out what ?: does in for example this case
?:
val list = mutableList ?: mutableListOf()
and why can it be modifi
The elvis operator in Kotlin is used for null safety.
x = a ?: b
In the above code, x will be assigned the value of a if a is not null and b if a is null.
x
a
null
b
The equivalent kotlin code without using the elvis operator is below:
x = if(a == null) b else a