Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6386158
Votes 0
Synopsis (coll) Provide collection class internal consistency validation methods
Category java:classes_util
Reported Against
Release Fixed
State 5-Cause Known, request for enhancement
Priority: 4-Low
Related Bugs 6385838
Submit Date 15-FEB-2006
Description
Doug Lea writes:

"It might be a nice touch to have a
validateOrder method in sorted collections. People can easily
write these themselves, but supplying standard versions might
help sensitize users to issues."

Similarly, hashmaps can be corrupted if their elements
change in any way that changes their hashCode().

It would be prohibitively expensive to perform this kind of
check on every access to the collection, but useful as a 
debugging aid and sanity check.
Posted Date : 2006-02-15 16:52:39.0
Work Around
N/A
Evaluation
I suggest that TreeSet and HashMap could both have a method of the
same name.  Perhaps "validate" or "checkInvariants".
Improves the testability of our implementations and of client code.
Posted Date : 2006-02-15 16:55:53.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang