commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michal Plechawski" <Michal.Plechaw...@empolis.pl>
Subject Re: [Collections][SUBMIT] TypedList
Date Tue, 30 Apr 2002 09:00:03 GMT
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>


Mime
View raw message