The need for the extra ?
here make me wish there was something along the lines of takeIfNotNull(predicate, action)
… just something to make it clear the action is only called if the predicate is non-null. Could see myself wrapping takeIf
with my own function if I ever need it.
The first example there is a subtle gotcha for sure