commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rafael U. C. Afonso" <r.u.c.afo...@uol.com.br>
Subject Tranformer collection processor
Date Wed, 04 Aug 2004 02:09:30 GMT
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


Mime
View raw message