[COLLECTIONS] CollectionUtils.adapterCollection(Collection<E>, Transformer<A>)?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[COLLECTIONS] CollectionUtils.adapterCollection(Collection<E>, Transformer<A>)?

Benedikt Ritter-3
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
Reply | Threaded
Open this post in threaded view
|

Re: [COLLECTIONS] CollectionUtils.adapterCollection(Collection<E>, Transformer<A>)?

Matt Benson-2
Looks like a job for [functor].

Matt
On Sep 18, 2013 2:59 PM, "Benedikt Ritter" <[hidden email]> 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
>
Reply | Threaded
Open this post in threaded view
|

Re: [COLLECTIONS] CollectionUtils.adapterCollection(Collection<E>, Transformer<A>)?

Bruno P. Kinoshita
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 <[hidden email]>
To: Commons Developers List <[hidden email]>
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" <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [COLLECTIONS] CollectionUtils.adapterCollection(Collection<E>, Transformer<A>)?

Evan Ward
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 <[hidden email]>
> To: Commons Developers List <[hidden email]>
> 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" <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>

business_cards_final.pdf (47K) Download Attachment
smime.p7s (6K) Download Attachment