any notable difference between `removeIf((E) ->...
# announcements
e
any notable difference between
removeIf((E) -> Boolean)
and
removeAll((E)->Boolean)
?
l
removeIf
is not part of the stdlib but of Java's collections since Java 8. I'd just use
removeAll
since it's MPP compatible but if you only use Kotlin with Java >= 8, it does not really matter.
👍 1
e
I also prefer the later syntax-wise
d
Note that since
removeIf
is not an extension function it can do some performance optimizations (e.g. moving elements around in one go for
ArrayList
), which
removeAll
cannot do. In certain situations that might be desirable instead.
👍 1
e
Interesting