this request originates from one of our project where we have implemented something similar.
The Java-Interface java.util.Collection<E> specifies the two methods contains(Object o) and boolean removeAll(Collection<?> c). Both methods rely on the equals() method of the given Objects.
In some cases, it's not possible to change those methods and therefore removeAll and contains cannot be used directly.
E.g. if you have an class myClass with property A and B and the equals method uses both properties, but you are only interested in property B.
To solve this problem, I'd like to propose the following extensions of CollectionsUtils:
Both methods do basically the same as their native equivalient but use a comparator instead of equals().
This allows the injection of any required compare value:
If you think those methods are a good idea (as proposed or changed according to any rules), please give me a short feedback and I'll offer an implementation as diff patch for review.