Hi all,

There is one item pending from the last poll to release [functor], regarding a 
TODO in CollectionTransformer. Excerpt below: 


     * TODO revisit this class... it could stand a more-descriptive name.  
Also, it's a little
     * hard to say whether, for an instance constructed without a specific 
target collection,
     * #evaluate() should return a new ArrayList for each call, or continue 
adding to
     * a single ArrayList instance (the current behavior).
     * Perhaps this is more a documentation issue than anything.

And the comments on the TODO items.


> it could stand a more-descriptive name.

I'm +0 to rename. The only name that I could think of was 
GeneratorToCollectionTransformer, but found some on the Internet after looking 
for 'convert generator to iterator' and 'convert generator to list': Listify, 
Eagerlize and Lazy List Builder. 


I liked Lazy List Builder, as this class creates a list from a given generator, 
but only when you call the evaluate(Generator) method (lazily initializing the 
list). Anyone has other thoughts on this? 


> Also, it's a little hard to say whether, for an instance constructed without 
> a specific target collection,
> #evaluate() should return a new ArrayList for each call, or continue adding to
> a single ArrayList instance (the current behavior).

The constructor doesn't return a new ArrayList for each call anymore. Now it 
validates whether the list is null or not null, throwing an exception if the 
former is true. 


After an instance of CollectionTransformer is created, for every call of 
evaluate(Generator) it adds the generator elements to the given list. It means 
that if you call the evaluate method 10 times, it will return the same list 
with more elements. 


I'm +1 for changing this behaviour too and returning a new list for each call 
of evaluate(Generator). This way we don't have to worry about multiple threads 
accessing the same list object. If nobody is against this I will file an issue 
to work on this. 

Finally, the javadocs are out of date, so I would like to update it with our 
consensus on these items :-)

Many thanks in advance!


Bruno P. Kinoshita
http://kinoshita.eti.br
http://tupilabs.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to