PATCH: Collections, episode iv
Bryce McKinlay
bryce@albatross.co.nz
Sun Dec 10 19:43:00 GMT 2000
The old classpath implementations of HashMap and Hashtable tried to
share code through a common linked list implementation in Bucket.java.
This actually resulted in a lot of unnecessary complexity and bloat.
These new implementations do result in code duplication, but there's
not much that can be done to avoid that given the way the API is
designed (for legacy compatibility). They are however simpler,
smaller, faster, and (touch wood) less buggy than the old ones.
There's also some more Collections.java fixes and optimizations, and
I've imported WeakHashMap nad java/lang/ref from classpath.
Unfortunately WeakHashMap does *not* work with the current compiler
due to the finit$ bug, so we won't build it just yet. (I see the
finit$ problems very regularly... usually they are easy to work around
by moving init code from initializers to constructors, but in this
case the problem occurs in an anonymous class so its not trivial/clean
to work around.) WeakHashMap of course won't really work properly
until the GC actually supports reference objects, but it would be nice
to have so that code that uses it will at least compile.
I'm checking this in. I've actually tested it a bit this time so
hopefully there won't be a repeat of the Vector fiasco ;-)
Just TreeMap and TreeSet to go now.
regards
[ bryce ]
More information about the Java-patches
mailing list