You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br> on 2004/08/18 14:36:46 UTC

Collections HowTo

Hi all. Any directions on how to use Functors and Predicates ?

-- 
Leandro Rodrigo Saad Cruz
InterBusiness Tecnologia e Serviços
IB    - www.ibnetwork.com.br
DB    - www.digitalbrand.com.br
OJB   - db.apache.org/ojb
XINGU - xingu.sf.net


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


Re: Collections HowTo

Posted by Arnd Kohrs <ko...@acm.org>.
A very intriguing introduction to functors in Java can also be found
here: http://c2.com/cgi/wiki?BlocksInJava

That article is only weakly related to the functors which are
part of collections but rather related to sandbox/Functor. 

Cheers,
Arnd.


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


Re: Collections HowTo

Posted by Rodney Waldhoff <rw...@apache.org>.
There's a more comprehensive introduction to functors at 
http://jakarta.apache.org/commons/sandbox/functor, with a number of 
detailed examples at 
http://cvs.apache.org/viewcvs.cgi/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/.

- Rod

On Wed, 18 Aug 2004, Leandro Rodrigo Saad Cruz wrote:

> What is the concept behind Functor/Predicate/Transformer ?
>
> On Wed, 2004-08-18 at 10:44, matthew.hawthorne wrote:
>> Leandro Rodrigo Saad Cruz wrote:
>>> Hi all. Any directions on how to use Functors and Predicates ?
>>
>>
>> Hmm... maybe read the Javadoc?
>>
>> It's hard to respond to such a vague question, do you have a more
>> specific problem you're trying to solve?
>>
>> Basically, there are methods in CollectionUtils that take a collection
>> and a Functor/Predicate/Transformer as a parameter.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> --
> Leandro Rodrigo Saad Cruz
> InterBusiness Tecnologia e Servi�os
> IB    - www.ibnetwork.com.br
> DB    - www.digitalbrand.com.br
> OJB   - db.apache.org/ojb
> XINGU - xingu.sf.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

Re: Collections HowTo

Posted by José Antonio Pérez Testa <ja...@indra.es>.
All that concepts are imported into java from Functional Programming 
Languages such as Prolog or CAML.

IMHO they give a hand when working with Collections extracting the 
process out of the loop.
For example, if you want to add all the elements of a List you only have 
to define the add process and delegate to the Functor the loop itself.
When you have a list of  some type and need a list of some other type 
objects you only define the Transformer,
and if you want to select objects from a Collection based on some 
criteria, you have to code the criteria , pass it to a Functor and 
you'll have in return a new list with ONLY those objects.

Is another just another look into programming!

Leandro Rodrigo Saad Cruz wrote:

>What is the concept behind Functor/Predicate/Transformer ?
>
>On Wed, 2004-08-18 at 10:44, matthew.hawthorne wrote:
>  
>
>>Leandro Rodrigo Saad Cruz wrote:
>>    
>>
>>>Hi all. Any directions on how to use Functors and Predicates ?
>>>      
>>>
>>Hmm... maybe read the Javadoc?
>>
>>It's hard to respond to such a vague question, do you have a more 
>>specific problem you're trying to solve?
>>
>>Basically, there are methods in CollectionUtils that take a collection 
>>and a Functor/Predicate/Transformer as a parameter.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>    
>>
-------------------------------------------------------------------------------------------------------------------
Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, contiene información de carácter confidencial exclusivamente dirigida a su destinatario o destinatarios. Queda prohibida su divulgación, copia o distribución a terceros sin la previa autorización escrita de Indra. En el caso de haber recibido este correo electrónico por error, se ruega notificar inmediatamente esta circunstancia mediante reenvío a la dirección electrónica del remitente.

The information in this e-mail and in any attachments is confidential and solely for the attention and use of the named addressee(s). You are hereby notified that any dissemination, distribution or copy of this communication is prohibited without the prior written consent of Indra. If you have received this communication in error, please, notify the sender by reply e-mail

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


Re: Collections HowTo

Posted by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br>.
What is the concept behind Functor/Predicate/Transformer ?

On Wed, 2004-08-18 at 10:44, matthew.hawthorne wrote:
> Leandro Rodrigo Saad Cruz wrote:
> > Hi all. Any directions on how to use Functors and Predicates ?
> 
> 
> Hmm... maybe read the Javadoc?
> 
> It's hard to respond to such a vague question, do you have a more 
> specific problem you're trying to solve?
> 
> Basically, there are methods in CollectionUtils that take a collection 
> and a Functor/Predicate/Transformer as a parameter.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
-- 
Leandro Rodrigo Saad Cruz
InterBusiness Tecnologia e Serviços
IB    - www.ibnetwork.com.br
DB    - www.digitalbrand.com.br
OJB   - db.apache.org/ojb
XINGU - xingu.sf.net


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


Re: Collections HowTo

Posted by "matthew.hawthorne" <ma...@apache.org>.
Leandro Rodrigo Saad Cruz wrote:
> Hi all. Any directions on how to use Functors and Predicates ?


Hmm... maybe read the Javadoc?

It's hard to respond to such a vague question, do you have a more 
specific problem you're trying to solve?

Basically, there are methods in CollectionUtils that take a collection 
and a Functor/Predicate/Transformer as a parameter.


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