You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Stephen Colebourne <sc...@eurobell.co.uk> on 2002/05/01 00:11:13 UTC

Re: [Collections][SUBMIT] TypedList

From: Michal Plechawski <Mi...@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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>