commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <>
Subject Re: [collections] CaseInsensitiveHashMap
Date Mon, 24 Nov 2003 22:59:29 GMT

I would like to propose an alternative solution to the problem that IMO fits
well with current [collections] direction.

Consider a new Map implementation that acts as a direct replacement for
HashMap, call it HashMapA (A for apache ;-). This class contains basically
the same code as HashMap, although it must be written without using cut and
paste (ie from scratch - Sun licence issues).

HashMapA differs from HashMap in that the hashing algorithm and equals
comparison methods are dedicated protected methods. It then becomes easy for
a subclass to be written that compares keys using case insensitivity
(amongst other things). HashMapA would also have a mapIterator() method to
access the new map iterator concept.

Finally, there would probably need to be a MapA interface to allow access to
the map iterator.


----- Original Message ----- > >
 Umm, I didn't notice #get did not apply the transformation. Perhaps not
> > such a good idea to use TransformedMap after all.
> >
> > This behaviour is certainly different to my expectations (although the
> > documentation is clear enough on this point). I wonder what the original
> > use-case for TransformedMap was.
> >
> > If the database client code restricts itself to using lowercase names
> > (an aspect you are in control of) TransformedMap could still be useful
> > but hardly as convenient as the original case insensitive map.
> It's a requirement that DbUtils clients use whatever case they want to
> refer to column names in a Map so TransformedMap as it is now won't work.
> Regardless, DbUtils doesn't have a dependency on collections and shouldn't
> add one just for this feature.  The implementation of
> CaseInsensitiveHashMap is trivial enough to maintain in DbUtils.  I opened
> the enhancement against collections in case anyone else had a need for
> this kind of Map.  If TransformedMap doesn't change then I think adding
> CaseInsensitiveMap is the best solution.
> >
> > -Janek
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > For additional commands, e-mail:
> >
> __________________________________
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message