From the method’s doc:
Modifies the current HashSet<T> object to contain all elements that are present in both itself and in the specified collection.
Now I know my way around (at least the basics of) set theory, and I know what union means. nonetheless I read the doc of the method and for some reason I thought that I’d get the intersection.
For those unsure about what Union means (or what it actually does), the following code:
So, I ended up bumping my head on the wall keyboard for a couple of minutes trying to understand why a perfectly good test fail with no reason, until I figured it out. It is true that I wasn’t showing a huge amount of smartness here, and it could be that my English skills are poor, but I believe replacing “and” with “or” will serve the method’s doc better.
If the BCL was open source I would have sent a patch with the doc fix …