commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Carman <>
Subject [collections] ChainedTransformer...
Date Mon, 08 Jun 2009 03:22:49 GMT

I thought I'd check out the collections_jdk5_branch to see if there
was anything that I could tinker with.  I decided to look into the
functors, since that's what I'm mainly interested in.  Immediately I
noticed ChainedTransformer.  It's declared as:

public class ChainedTransformer<T> implements Transformer<T, T>, Serializable

So, does this mean that a ChainedTransformer always has to have the
same input and output types?  Transformer is declared as:

public interface Transformer<I, O> {
    public O transform(I input);

Shouldn't it support different input/output types?

What I was thinking about would be a new way to think about these chains:

public class ChainedTransformer<I,O> implements Transformer<I,O>
  public ChainedTransformer(Transformer<I,O> initial);
  public O transform(I input);
  public <T> ChainedTransformer<I,T> append(Transformer<O,T> next);

Typically, to create a ChainedTransformer, you have to put your
transformers in a collection and pass them in to create one.  This
way, instead of having to create a new collection, you'd just append
as you go.  What do you think?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message