Just wondering if HashSet.equals(anotherHashSet) runs in constant time (also with a ConcurrentHashSet as argument), which I’m assuming it does for efficiency reasons. Can’t see anything which mentions it, and a portion of the framework I’m building relies on the functionality (wouldn’t want it to take too long!).
Edit: sorry, realised that there was no way that HashSet.equals() could ever run in constant time, since the elements can change while the hashcode for the elements in the map remains the same. Therefore, the best way to approach this problem would be to use hashcode. Does it reek of a code smell though?
Looking at a typical implementation shows that it does
containsAll. Each check to contains is going to be O(1) and N of them are going to have to be made, so I reckon O(N).