commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Colebourne <>
Subject Re: [collections] IndexTransformer in 3.2?
Date Thu, 24 Nov 2005 21:43:22 GMT
James Carman wrote:
> I put in a Bugzilla request for an IndexTransformer class.  Basically, it
> just returns the value from the input (input can be List, array, String, or
> StringBuffer) at a specified index.
We already have a CollectionUtils method for getting the indexed object 
from a List/Map/Array etc.

>  We've used a similar class in our
> application when we want to put the values from a query result (Collection
> of Object[]) into a map.  We do something like this...
> public void populateMap( Map map, Collection objects, Transformer
> keyTransformer, Transformer valueTransformer );
> And, you'd use it like this (assuming we did something like select,
> from SomeClass x)...
> populateMap( map, queryResults, new IndexTransformer(0), new
> IndexTransformer(1));
> Do you think I could also add the populateMap method (there's another flavor
> of it that just uses the object itself as the value using a no-op
> transformer)?
The populateMap methods definitely look useful and should be added.

The transformer is just one of many, many transformers that could be 
added. The problem is when to stop, see new thread.


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

View raw message