commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz" <>
Subject Re: [collections] CaseInsensitiveHashMap
Date Sat, 03 Jan 2004 18:20:38 GMT
Stephen Colebourne wrote:


> Well CaseInsensitive as a name doesn't imply to me that it changes anything.
> It implies that is compares insenstively (including equals, which should be
> handled). 

So two maps whose keys differ only on key case *are* equal?

> This map would be a LowerCaseKeyMap or some such.
> It strikes me that if I put a key in one way, I should get it back that way
> too.

I guess that is a valid point, though the cost of this will be to force 
every comparison to do something like toString().toLower().

> BTW: the names now exclude 'Hash' as much as possible, hence it would be
> CaseInsensitiveMap
<side comment>
It is interesting to note that what is going on here is that a 
CaseInsensitiveMap is a map on equivalence classes of keys and the design 
question is whether to store canonical equivalence class representatives 
and use canonicalized access functions or to implement the equivalence 
relation internally.  The advantage of the second approach is that you can 
recover the keys exactly as they have been entered, the disadvantage is 
that one-time canonicalization may be more efficient.
</side comment>


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

View raw message