-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi,
I want to use ReferenceMap, and am working on a Java 1.5 project, where I heavily use generics. So I decided to generify (part of) the commons collections classes. While doing so, I stumbled on a problem that would not be generified. The reason for this is bad design. The class AbstractHashedMap.KeySetIterator inherits from EntrySetIterator. But the return types of those two are, when generified, incompatible. To be able to make them generic, all those protected static inner classes first have to be made non-static (such that they have access to the type of key and value from the parent list). Then, the appropriate extension has to be chosen. For EntrySetIterator, this would be HashIterator<Map.Entry<K,V>>. But KeySetIterator extends this, which implies its next() method would return a Map.Entry<K,V>. This is not what we want. Instead, we want it to inherit from HashIterator<K>. And indeed, this is the simple solution: just have it extend HashIterator<K>. So if this is the correct (I hope) solution with generics, I suppose the same is true without generics. Now that we talk about it, is there a reason other than ‘Nobody has taken the time to convert yet’ that the Jakarta Commons Collections do not use 1.5 generics? Is it useful to generify it? (I would be prepared to send in that which I am doing now.) I am not subscribed to the mailing list, please CC me. Cheers, H. - -- Hendrik Maryns Herrenberger Straße 40 D-72070 Tübingen +49707143783 (Deutschland fest) +491753353494 (Deutschland Handy) +32485470741 (België) ================= www.lieverleven.be (waarom zou ik hier toch naar verwijzen...) http://aouw.org De kunst van het stedelijke oorlogvoeren -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFEiLXpBGFP0CTku6MRAqvMAJwNRSilp83l8ZaXyJauk2s3Qoe1fwCdGdZq OqXKoDC9+Wkmwe4P47xxf9s= =UrWj -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
