commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james_strac...@yahoo.co.uk>
Subject Re: [Collections][SUBMIT] TypedList
Date Tue, 30 Apr 2002 15:10:24 GMT
Just being Devil's advocate for a moment but....
Couldn't this kind of thing be done with custom Comparators and (say)
TreeMap?

James
----- Original Message -----
From: "Michal Plechawski" <Michal.Plechawski@empolis.pl>
To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
Sent: Tuesday, April 30, 2002 10:00 AM
Subject: Re: [Collections][SUBMIT] TypedList


> Hello,
>
> I would like to give an use case for "TransformedMap", that may need
> changing a concept a bit.
> Let's say we want to have a map mapping case-insensitive Strings to
> anything. We could just put them with s.toLowerCase(), and when checking
> whether a key exists or getting its value we could use toLowerCase(), too.
> However, this easily may lead to some hard-to-find errors, it bloats the
> code etc.
> My idea was to - like in the TransformMap - hide the transformation in the
> wrapper class. However, the best way to do that in my case was to do that
> _consequently_ for all Map interface methods - putting to the map, getting
> values, getting entry or key sets etc. A kind of completely "transparent"
> transformation.
> That could be useful in any case when we need to "normalize" objects in
some
> way, and use "normalized" ones instead of arbitrary ones. This would apply
> primarily to maps and sets, but not only of course. However, I do not see
> why the uconsequent solution (ie. transforming map keys only when putting
> them to the map) could be useful.
>
> Michal Plechawski
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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


Mime
View raw message