Submitted On 25-MAY-2001
dmbdmb
I agree with the evaluation, My point is the documentation
doesn't clearly explain this. All I want is for the doc to
read:
"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 e.hashCode
() == o.hashCode(), and ((o == null) ? (e == null) :
o.equals(e))"
Submitted On 11-NOV-2001
mpopesun
You have no idea the 100,000's of programmers who have wasted hours each debugging this horrible
documentation and implementation bug. Both in HashSet, and in TreeSet, it is stated that equals(obj) is
called on the elements, which would call the programmers' defined equals(..) method to exhibit well-defined
equality behaviour. Whoever wrote that comment 'nothing is wrong with the JRE' should be fired.
Submitted On 22-FEB-2002
mitalub
The documentation leads one to believe that .equals is used
in determining if the object is in the Set, as with
ArrayList. This documentation should make it clear that
the hashcodes are what is used.
Submitted On 19-JUN-2002
jswann
Seriously, how much effort would it take to FIX THE DOCUMENTATION?
Refusing to do so seems pretty uncooperative -- and out of character.
Submitted On 06-JUN-2003
deckm
Add my name to the list of the 100,000's who have wasted
hours. The documentation in 1.4.1 still says "returns true
if and only if this set contains an element e such that
(o==null ? e==null : o.equals(e))" which certainly implied
to me that you're doing the equals operation on the element
and not on the element's hashcode. Several hours later,
after realizing that it works right if I use another
container like Vector, I got the idea to check the bug
parade. It's outrageous to argue that this neither a code
bug nor a doc bug!
Submitted On 17-OCT-2003
jpaulkeller
I agree with above comments. Please fix the docs! I just
wasted a day with essentially the same problem (in TreeSet).
Submitted On 08-MAY-2004
Trakisko
The documentation still hasn't been clarified as of
version 1.4.2. It should be. One shouldn't have to
consult the BugParade to find out how this method
really works.
Submitted On 22-MAY-2007
xerces8
JDK 1.5.0 , no change...
Submitted On 23-MAY-2007
virgo47
Yup, I completely agree. Sun is quite stubborn (and not right) with few bugs and this is one of them.
Of course... Java SE 6 still the same.
Submitted On 21-NOV-2007
DAMN.. i just spent an entire hour debugging this crap.. IMHO, fixing the documentation isn't an option.. The implementation is wrong. The Set interface clearly says "o.equals(e)".. nothing about hashCode()... Simply changing the documentation does not fix the problem. It's an interface. Respect it.
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|