anyone have a good idiom for solving this problem?...
# announcements
j
anyone have a good idiom for solving this problem?
given two nullable lists,
a: List<String>?
and
b:List<String>?
if any are not null, return a concat list
else return null
g
Also
Copy code
(b.orEmpty() + a.orEmpty()).takeIf { it.isNotEmpty() }
But little bit less efficient if both lists are null because will be created a new collection