commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Janek Bogucki <...@studylink.com>
Subject Re: [collections] CaseInsensitiveHashMap
Date Mon, 24 Nov 2003 20:45:23 GMT
On Mon, 2003-11-24 at 10:15, David Graham wrote:
> 
> --- Janek Bogucki <yan@studylink.com> wrote:
> > On Sun, 2003-11-23 at 21:53, Phil Steitz wrote:
> > > A few weeks back, David Graham submitted code for a 
> > > CaseInsensitiveHashMap here:
> > > 
> > > http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24537
> > > 
> > > This looks like a good addition to [collections] to me.
> > > 
> > > Any objections to my coding up some tests and adding this class to the
> > 
> > > map package?
> > > 
> > > Phil
> 
> > 
> > It might be best to use an instance of o.a.c.c.decorators.TransformedMap
> > with a lower case key transformer and a null value transformer to
> > implement this class. Even though the posted implementation is simple,
> > using the decorator removes the need to have the 'plumbing' code
> > currently present -- and illustrates the use of the collections library.
> > 
> 
> That's a good idea.  I was not aware of TransformedMap or the Transformer
> interface.  It seems like they were designed to avoid writing classes like
> CaseInsensitiveHashMap :-).  However, it only transforms objects on put()
> calls and not on get().  That behavior would need to change.
> 
> David
> 

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.

-Janek

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message