Does retainAll use equals ?

Hi,

I have a LinkedHashMap which has strings as its keys and objects of my own class as the values. I want to remove all entries from this map where the values are not present in a set that I pass to it. The natural choice seemed to me to use the values() method to get the set of values, and use retainAll. However, I am finding that my LinkedHashMap is empty!

I have prepared some much simpler code that illustrates the same problem: