DEV Community 👩‍💻👨‍💻


Posted on

Apache CollectionUtils subtract and removeAll difference

Maven Dependency

Enter fullscreen mode Exit fullscreen mode

Difference between subtract and removeAll

You can use CollectionUtils.removeAll(collection, remove) or CollectionUtils.subtract(collection, remove) to remove certain element from collections, the difference is that the former can reuse element in remove variable, the later can not.
You can view detailed example here

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.