-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
7
-
x86
-
linux
A DESCRIPTION OF THE PROBLEM :
The TreeSet javadoc claims that the add method:
"More formally, adds the specified element e to this set if the set contains no element e2 such that (e==null ? e2==null : e.equals(e2)). If this set already contains the element, the call leaves the set unchanged and returns false."
This is not correct, since only the comparable interface is used to assert equality in the source code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A reference to the comparable interface being used to assert equality instead of the equals method.
ACTUAL -
More formally, adds the specified element e to this set if the set contains no element e2 such that (e==null ? e2==null : e.equals(e2)). If this set already contains the element, the call leaves the set unchanged and returns false.
URL OF FAULTY DOCUMENTATION :
http://docs.oracle.com/javase/7/docs/api/java/util/TreeSet.html#add(E)
The TreeSet javadoc claims that the add method:
"More formally, adds the specified element e to this set if the set contains no element e2 such that (e==null ? e2==null : e.equals(e2)). If this set already contains the element, the call leaves the set unchanged and returns false."
This is not correct, since only the comparable interface is used to assert equality in the source code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A reference to the comparable interface being used to assert equality instead of the equals method.
ACTUAL -
More formally, adds the specified element e to this set if the set contains no element e2 such that (e==null ? e2==null : e.equals(e2)). If this set already contains the element, the call leaves the set unchanged and returns false.
URL OF FAULTY DOCUMENTATION :
http://docs.oracle.com/javase/7/docs/api/java/util/TreeSet.html#add(E)
- duplicates
-
JDK-7030899 (coll) TreeSet uses the wrong method for equality detection during add(E)
-
- Closed
-