-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
7
-
x86
-
windows_7
A DESCRIPTION OF THE PROBLEM :
Documention of TreeSet.contains(Object o) states that this method returns true if this set contains an element e such that (o==null ? e==null : o.equals(e)). It is not true, because:
If o == null then NullPointerException is thrown, see @Throws;
If this set uses natural ordering then this method returns true if this set contains an element e such that (((Comparable)o).compareTo(e) == 0);
If this method uses comparator then it returns true if this set contains an element e such that (comparator.compare(o, e) == 0).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that (o==null ? e==null : o.equals(e)).
ACTUAL -
Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that (((Comparable)o).compareTo(e) == 0) if this this set uses natural ordering or (comparator.compare(o, e) == 0) if this set uses comparator.
URL OF FAULTY DOCUMENTATION :
http://docs.oracle.com/javase/7/docs/api/java/util/TreeSet.html#contains(java.lang.Object)
Documention of TreeSet.contains(Object o) states that this method returns true if this set contains an element e such that (o==null ? e==null : o.equals(e)). It is not true, because:
If o == null then NullPointerException is thrown, see @Throws;
If this set uses natural ordering then this method returns true if this set contains an element e such that (((Comparable)o).compareTo(e) == 0);
If this method uses comparator then it returns true if this set contains an element e such that (comparator.compare(o, e) == 0).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that (o==null ? e==null : o.equals(e)).
ACTUAL -
Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that (((Comparable)o).compareTo(e) == 0) if this this set uses natural ordering or (comparator.compare(o, e) == 0) if this set uses comparator.
URL OF FAULTY DOCUMENTATION :
http://docs.oracle.com/javase/7/docs/api/java/util/TreeSet.html#contains(java.lang.Object)