commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kishore Senji <kse...@gmail.com>
Subject Re: Tranformer collection processor
Date Wed, 04 Aug 2004 02:23:20 GMT
CollectionUtils.transform(Collection collection, Transformer
transformer); does what you have proposed

On Tue,  3 Aug 2004 23:09:30 -0300, Rafael U. C. Afonso
<r.u.c.afonso@uol.com.br> wrote:
> Hello:
> 
> Is there something in Collections that, given a collection
> and a Transformer, return a collection of transformed
> Objects?
> It would be like this:
> 
> class TransformeProcessorCollection {
>    private Transformer transformer;
> 
>    public TransformeProcessorCollection(Transformer trans) {
>        transformer = trans;
>    }
> 
>    public Collection process(Colletcion col) {
>        Collection newCol = new ArrayList(col.size); // Or
> some other type of Collection
>        Iterator it = new TransformIterator(col.iterator(),
> transformer);
>        while(it.hasNext()) {
>            newCol.add(it.next());
>        }
>        return newCol;
>    }
> 
> }
> 
> If it does not exist, I would like suggest it for Commons
> Collections. Something similar would be done with Closures
> and Predicates.
> 
> Thanks,
> 
> Rafael Ubiratam Clemente Afonso
> r.u.c.afonso@uol.com.br
> ---------------------------------
> Where is Debug?
> Debug is on the Table!
> 
> __________________________________________________________________________
> Acabe com aquelas janelinhas que pulam na sua tela.
> AntiPop-up UOL - É grátis!
> http://antipopup.uol.com.br/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message