wei
06/06/2018, 5:21 PMList<String>? and I want to check that it contains at least one element. Is it possible to use just one condition check? I’ve tried:
val t: List<String>? = null
println(t?.size != 0)
and this prints true, which is not what I want.
I tried: !t?.size?.equals(0) but I can’t use this in an if because it’s Boolean?.Andreas Sinz
06/06/2018, 5:26 PMt?.isEmpty() ?: truewei
06/06/2018, 5:28 PMAndreas Sinz
06/06/2018, 5:31 PMt?.isNotEmpty() ?: false returns true if the list exists and has at least one element