c73d43c214
The algorithms for removeAll, retainAll and removeIf were almost identical. The main difference was, that removeIf calls a lambda, whereas removeAll and retainAll executed the check directly. Both methods call indexOf on an IntList, which easily outweighs the extra cost of the lambda. It makes sense to consolidate and remove the duplicated code. I ran a few benchmarks with different list sizes before the replacement. The results are not as clear as I would have liked. In some cases, especially for short lists, the special implementations of removeAll/retainAll were up to 10% faster. In other situations I saw 50% difference the one day, but could not reproduce those results a day later. This leads me to believe, that my test setup is not trustworthy. That means I stay with what I now. The code is identical with one tiny difference. And that difference shouldn't matter, because indexOf is much more expensive.