https://kotlinlang.org logo
c

cedric

06/12/2016, 2:20 PM
@yole: This
appendIf
is useful more broadly too. For example, I often need to build a list that's either
(a)
or
(a,b)
for a certain condition:
Copy code
val l = buildList { 
    a
    if (condition) b
}
Without it, not much choice besides making
l
a
var