You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Benedikt Ritter <be...@gmail.com> on 2013/09/18 21:59:20 UTC

[COLLECTIONS] CollectionUtils.adapterCollection(Collection, Transformer)?

Hi,

At work, I needed to create an adapter for an existing class that has a
getter for a collection of objects. Now in my adapter I want to create a
getter for a collection of adapted objects.
I don't want to create a new list an add adapters for the contained objects
to it. I just want to create the adapters on the fly when they are
requested.

I thought this should be implemented somewhere in commons-collections, but
I could not find anything like that. I wonder if it would make sense to
create such functionality. I have created an example at github [1]. What do
you think? Am I missing something here?

Regards,
Benedikt

[1] https://gist.github.com/britter/6614535

Re: [COLLECTIONS] CollectionUtils.adapterCollection(Collection, Transformer)?

Posted by Evan Ward <ev...@nrl.navy.mil>.
Hi John,

I've attached my form.

Thanks,
Evan

On Wed 18 Sep 2013 09:23:10 PM EDT, Bruno P. Kinoshita wrote:
> True, maybe with EachElement and a Procedure [1], or maybe IteratorToGeneratorAdapter, or something similar to the ArrayListBackedAggregator and some custom function :) Or maybe with something totally new.
>
> [1] https://gist.github.com/kinow/6617618
> ________________________________
> From: Matt Benson <gu...@gmail.com>
> To: Commons Developers List <de...@commons.apache.org>
> Sent: Wednesday, September 18, 2013 5:29 PM
> Subject: Re: [COLLECTIONS] CollectionUtils.adapterCollection(Collection<E>, Transformer<A>)?
>
>
> Looks like a job for [functor].
>
> Matt
> On Sep 18, 2013 2:59 PM, "Benedikt Ritter" <be...@gmail.com> wrote:
>
>> Hi,
>>
>> At work, I needed to create an adapter for an existing class that has a
>> getter for a collection of objects. Now in my adapter I want to create a
>> getter for a collection of adapted objects.
>> I don't want to create a new list an add adapters for the contained objects
>> to it. I just want to create the adapters on the fly when they are
>> requested.
>>
>> I thought this should be implemented somewhere in commons-collections, but
>> I could not find anything like that. I wonder if it would make sense to
>> create such functionality. I have created an example at github [1]. What do
>> you think? Am I missing something here?
>>
>> Regards,
>> Benedikt
>>
>> [1] https://gist.github.com/britter/6614535
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

Re: [COLLECTIONS] CollectionUtils.adapterCollection(Collection, Transformer)?

Posted by "Bruno P. Kinoshita" <br...@yahoo.com.br>.
True, maybe with EachElement and a Procedure [1], or maybe IteratorToGeneratorAdapter, or something similar to the ArrayListBackedAggregator and some custom function :) Or maybe with something totally new.

[1] https://gist.github.com/kinow/6617618
________________________________
From: Matt Benson <gu...@gmail.com>
To: Commons Developers List <de...@commons.apache.org> 
Sent: Wednesday, September 18, 2013 5:29 PM
Subject: Re: [COLLECTIONS] CollectionUtils.adapterCollection(Collection<E>, Transformer<A>)?


Looks like a job for [functor].

Matt
On Sep 18, 2013 2:59 PM, "Benedikt Ritter" <be...@gmail.com> wrote:

> Hi,
>
> At work, I needed to create an adapter for an existing class that has a
> getter for a collection of objects. Now in my adapter I want to create a
> getter for a collection of adapted objects.
> I don't want to create a new list an add adapters for the contained objects
> to it. I just want to create the adapters on the fly when they are
> requested.
>
> I thought this should be implemented somewhere in commons-collections, but
> I could not find anything like that. I wonder if it would make sense to
> create such functionality. I have created an example at github [1]. What do
> you think? Am I missing something here?
>
> Regards,
> Benedikt
>
> [1] https://gist.github.com/britter/6614535
>  

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


Re: [COLLECTIONS] CollectionUtils.adapterCollection(Collection, Transformer)?

Posted by Matt Benson <gu...@gmail.com>.
Looks like a job for [functor].

Matt
On Sep 18, 2013 2:59 PM, "Benedikt Ritter" <be...@gmail.com> wrote:

> Hi,
>
> At work, I needed to create an adapter for an existing class that has a
> getter for a collection of objects. Now in my adapter I want to create a
> getter for a collection of adapted objects.
> I don't want to create a new list an add adapters for the contained objects
> to it. I just want to create the adapters on the fly when they are
> requested.
>
> I thought this should be implemented somewhere in commons-collections, but
> I could not find anything like that. I wonder if it would make sense to
> create such functionality. I have created an example at github [1]. What do
> you think? Am I missing something here?
>
> Regards,
> Benedikt
>
> [1] https://gist.github.com/britter/6614535
>