eygraber
07/04/2018, 4:04 AMb in b.isEmpty() but it does for a in a.isEmpty()?
val a: String? = null
val b: String? = null
when {
a == null && b == null -> true
a == null -> b.isEmpty()
b == null -> a.isEmpty()
}karn
07/04/2018, 5:55 AMa because you null check it prior so it cannot be null by the time it gets to executing isEmpty() while b can be null and the compiler can't 'smart cast'. You can fix this by null checking b prior and handing the null case or using b?.isEmpty() ?: true.karn
07/04/2018, 6:01 AMBoolean? -> Booleaneygraber
07/04/2018, 6:12 AMa and b cannot both be null
2. a is null
3. Since a is null and both a and b cannot be null, b must be not null