commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <>
Subject Re: [collections] CaseInsensitiveHashMap
Date Mon, 05 Jan 2004 00:11:14 GMT

On Sun, 4 Jan 2004, David Graham wrote:

> --- Stephen Colebourne <> wrote:
> > From: "David Graham" <>
> > > Just out of curiosity, why are you leaving Hash out of the names?  The
> > > Java idiom seems to be to indicate a collection's implementation in
> > the
> > > name.  Even the standard WeakHashMap maintains the "Hash" portion of
> > the
> > > name.  I'm not particularly tied to CaseInsensitiveHashMap but I chose
> > > that name based on current Java practices.
> >
> > Because people have assumed in the past that an XxxHashMap extends
> > HashMap
> > (normal Java naming practices). Its really just duplicate info anyway.
> java.util.WeakHashMap does not subclass java.util.HashMap but still
> includes "Hash" in the name.  They did that to indicate that it uses a
> hashtable in its implementation not that it subclasses a particular class.
>  So, I still believe the current Java practice is to indicate the impl. in
> the collection class name.

That's a fine reason to maintain the name.

Extending HashMap or implementing your own hashcode algorithm should earn
you the name 'HashMap', but most Maps in [Collections] should not be
HashMaps as that makes them implementation frozen.

I should be able to do:

new SoftRefMap( new CaseInsensitiveMap( new BeanMap( new HashMap() ) ) );

though I'm not sure exactly how the decorators are doing the decorating
currently, ie) might not be in the constructor.

CaseInsensitiveHashMap cannot fit into such a chained structure.

[an opinion]


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

View raw message