Are you wanting to add dates to the resulting collection and have them
transformed into Strings?  Or, are you just looking for a collection of
Strings that you don't need to modify which represent the dates?  If it's
the latter, you should use the CollectionUtils.collect() method rather than
the transformedCollection() method.  I too have been burned by that very
thing.  Just by looking at the name, it would seem that
transformedCollection() would return a collection which was the result of
applying the transformer to the input collection.  Not so!  I've learned
that the hard way a few times (bad memory).

-----Original Message-----
From: Rob Oxspring [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 07, 2005 11:42 AM
To: Jakarta Commons Developers List
Subject: [collections] TransformedCollection


Hi,

I've just been burnt (and not for the first time) by the fact that the 
TransformedCollection doesn't transform the objects that are already in 
the wrapped collection.  For example:

Collection dates = ... // a collection with Date objects in it Transformer
toString = ... // a transformer that calls toString Collection strings =
     CollectionUtils.transformedCollection(dates,toString);

My intuition tells me that strings should be full of String objects and 
have no Date objects in it but the opposite is true.  Is this the 
intended behaviour or is this a bug?  I'm happy to patch the 
TransformedCollection class but wanted to run it passed people first...

Thanks,

Rob

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to