Is it planned a `dropLastOrEmpty` (or `dropLastOrN...
# stdlib
j
Is it planned a
dropLastOrEmpty
(or
dropLastOrNull
?
r
dropLast
already returns an empty list if
n >= size
If you want a
null
variant:
dropLast(n).takeIf { it.isNotEmpty() }
j
I would expect it to crash, thank you!
e
.takeIf { it.isNotEmpty() }
.ifEmpty { null }