JDK-6360946 : (coll) SetFromMap.equals should perform identity check
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:collections
  • Affected Version: 6
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-12-08
  • Updated: 2012-10-08
  • Resolved: 2006-03-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b78Fixed
Related Reports
Relates :  
Description
Jason writes:

It seems that the SetFromMap.equals should first perform the identity check on 
itself before calling equals on the wrapped keyset.  The behavior would be 
more consistent with the other collections.

Comments
SUGGESTED FIX public void clear() { m.clear(); } - public boolean equals(Object o) { return keySet.equals(o); } + public boolean equals(Object o) { + return (o == this) || keySet.equals(o); + }
08-12-2005

EVALUATION Indeed. The check preserves the reflexive property of equals as an equivalence relation, when applied to concurrent collections.
08-12-2005