A DESCRIPTION OF THE PROBLEM :
The Javadoc for ConcurrentSkipListSet's add(E e) method states that the method "adds the specified element e to this set if the set contains no element e2 such that e.equals(e2)". This is not true, since it actually determines equality using natural ordering (i.e. a Comparable's compareTo method), unless a custom comparator is defined. This can lead to elements not being added because they were unexpectedly determined to be equal to another element.
The Javadoc for ConcurrentSkipListSet's add(E e) method states that the method "adds the specified element e to this set if the set contains no element e2 such that e.equals(e2)". This is not true, since it actually determines equality using natural ordering (i.e. a Comparable's compareTo method), unless a custom comparator is defined. This can lead to elements not being added because they were unexpectedly determined to be equal to another element.
- duplicates
-
JDK-8181579 Inconsistency between API documentation and TreeSet.add(...) behaviour
-
- Open
-