commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@eurobell.co.uk>
Subject Re: [Collections][SUBMIT] TypedList
Date Tue, 30 Apr 2002 22:11:13 GMT
From: Michal Plechawski <Michal.Plechawski@empolis.pl>
> Another thing is that I do not understand the real use case laying behind
> the discussed Transform-xxx. I do not see why somebody wants to put
> transformed elements into a collection, but ask for them directly. It
breaks
> some natural laws, like:
>
> map.put(x, y);
> map.containsKey(x); // this should be true
>
> I think that this may be very misleading for many people, and be the
reason
> of hard-to-find errors. IMHO this idea breaks basic Collection Framework
> intuitions.

The discussion in the WeakHashSet thread seemed to conclude that all input
into the collection would be transformed by the inputTransformer, and all
output would be transformed by the outputTransformer.

It will be important to support the case:
List list = TransformUtils.transformList(inputTransformer,
outputTransformer);
list.add("3");
Integer i = (Integer) list.get(0);
This is needed where the list is to contain objects of one type (Integer in
this example) but is to accept a variety of input types. (I submitted a type
conversion package ages back for this kind of thing, but it didn't get
anywhere)

> However, this Predicate-xxx stuff is a completely different story and a
good
> idea I think.

Coming soon...

Stephen


--
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