commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <>
Subject Re: [collections] CaseInsensitiveHashMap
Date Fri, 02 Jan 2004 22:59:08 GMT
From: "Phil Steitz" <>
> >>2. I made no attempt at allowing the locale to be set or otherwise
> >>changing the default behavior of toLower() in convert().
> >
> > I'm wondering how your implementation works. I was expecting the
isEqualKey() method to be overridden, rather than converting the key on add.
(Note that the same code also has to go in a MapEntry)
> >
> Could be I was being too lazy.  Since toLower() is "idempotent" (calling
> it repeatedly has same effect as calling it just once) it "works" to just
> override convert(), since in AbstractHashedMap, get, put, remove,
> containsKey, all start by converting the key (nice!).  All I did was to
> extend HashedMap and override convert to return
> key.toString().toLowerCase().  The effect is that you actually store all
> lower case strings as keys (or null, once I fix this). The behavior should
> be the same as the impl that David Graham posted with PR #24537 (unless I
> am missing something -- quite possible).
This impl will work, but I would prefer to see the case of the key
maintained, just the comparison to be case insensitive.


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

View raw message