nkiesel
04/21/2023, 3:43 PMJoffrey
04/21/2023, 3:49 PMnkiesel
04/21/2023, 4:19 PMJoffrey
04/21/2023, 4:21 PM?: emptyList()
, basically dealing with java issues at the java boundary. It's good practice to get rid of platform types quickly, so we might as well deal with null therenkiesel
04/21/2023, 4:26 PMif (!j.a.isNullOrEmpty()) process(j.a)
without having to create empty collections. But does not work for IntArray or BooleanArrayJoffrey
04/21/2023, 4:32 PMarray == null || array.isEmpty()
nkiesel
04/21/2023, 4:47 PMephemient
04/21/2023, 9:11 PMarray?.isEmpty() != false
nkiesel
04/22/2023, 1:20 AMarray?.isEmpty() == true
, but still surprised by the inconsistencyephemient
04/22/2023, 1:21 AM== true
means null
→ false
, which isn't what isNullOrEmpty()
doesnkiesel
04/22/2023, 1:22 AMJoffrey
04/22/2023, 5:12 AMarray == null
in a separate condition is probably better. Shorter is not necessarily more readable.ephemient
04/22/2023, 6:30 AM!= false
reads perfectly fine. == null ||
doesn't work for more complex expressions (without binding a name specifically for it)