You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Bruno P. Kinoshita" <br...@yahoo.com.br> on 2012/12/21 20:22:35 UTC
[functor] Using [fucntor] functional interfaces with Java 8 lambdas
Hi all,
Just wanted to let you guys know that I am successfully compiling and executing code using [functor] and Java 8. And am also using [functor] functional interfaces with lambdas.
So instead of writing:
UnaryPredicate isEven = new UnaryPredicate() {
public boolean test(Integer obj) {
return obj % 2 == 0;
}
};
One can simply write:
UnaryPredicate isEven = (Integer obj) -> { return obj % 2 == 0; };
FWIW, Google Guava's Predicate [1] is not a functional interface, so it cannot be used with lambdas, as in the example above.
I'll continue to experiment with [functor] and Java 8. There are only two open issues in Jira, one regarding generators (there's a branch with a proposal implementation) and another one about the equals() method in the [functor] API.
I wrote a short blog post [2] about how I'm running Java 8 in Eclipse Juno, in case anyone is interested in trying it too. The code is hosted at GitHub [3].
Cheers,
[1] http://code.google.com/p/guava-libraries/source/browse/guava/src/com/google/common/base/Predicate.java
[2] http://www.kinoshita.eti.br/2012/12/21/using-apache-commons-functor-functional-interfaces-with-java-8-lambdas/
[3] https://github.com/kinow/try-lambdas
Bruno P. Kinoshita
http://kinoshita.eti.br
http://tupilabs.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [functor] Using [fucntor] functional interfaces with Java 8 lambdas
Posted by "Bruno P. Kinoshita" <br...@yahoo.com.br>.
Thanks! And posting it to Reddit has brought interesting comments too. An user that seems to have a very good knowledge in other Java functional programming API's, Haskell and mathematics posted some comments there [1]. If we come up with anything worth adding to [functor] I will invite him to bring the discussion here to the mailing list :-)
BR,
[1] http://www.reddit.com/r/java/comments/158q1u/using_apache_commons_functor_functional/
Bruno P. Kinoshita
http://kinoshita.eti.br
http://tupilabs.com
----- Original Message -----
> From: Simone Tripodi <si...@apache.org>
> To: Commons Developers List <de...@commons.apache.org>; Bruno P. Kinoshita <br...@yahoo.com.br>
> Cc:
> Sent: Friday, December 21, 2012 7:37 PM
> Subject: Re: [functor] Using [fucntor] functional interfaces with Java 8 lambdas
>
> AMAZING
>
> congrats Bruno!
> -Simo
>
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
>
>
> On Fri, Dec 21, 2012 at 8:22 PM, Bruno P. Kinoshita
> <br...@yahoo.com.br> wrote:
>> Hi all,
>>
>> Just wanted to let you guys know that I am successfully compiling and
> executing code using [functor] and Java 8. And am also using [functor]
> functional interfaces with lambdas.
>>
>> So instead of writing:
>>
>>
>> UnaryPredicate isEven = new UnaryPredicate() {
>> public boolean test(Integer obj) {
>> return obj % 2 == 0;
>> }
>> };
>>
>> One can simply write:
>>
>> UnaryPredicate isEven = (Integer obj) -> { return obj % 2 == 0; };
>>
>> FWIW, Google Guava's Predicate [1] is not a functional interface, so it
> cannot be used with lambdas, as in the example above.
>>
>> I'll continue to experiment with [functor] and Java 8. There are only
> two open issues in Jira, one regarding generators (there's a branch with a
> proposal implementation) and another one about the equals() method in the
> [functor] API.
>>
>> I wrote a short blog post [2] about how I'm running Java 8 in Eclipse
> Juno, in case anyone is interested in trying it too. The code is hosted at
> GitHub [3].
>>
>> Cheers,
>>
>> [1]
> http://code.google.com/p/guava-libraries/source/browse/guava/src/com/google/common/base/Predicate.java
>> [2]
> http://www.kinoshita.eti.br/2012/12/21/using-apache-commons-functor-functional-interfaces-with-java-8-lambdas/
>> [3] https://github.com/kinow/try-lambdas
>> Bruno P. Kinoshita
>> http://kinoshita.eti.br
>> http://tupilabs.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [functor] Using [fucntor] functional interfaces with Java 8 lambdas
Posted by Simone Tripodi <si...@apache.org>.
AMAZING
congrats Bruno!
-Simo
http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/
On Fri, Dec 21, 2012 at 8:22 PM, Bruno P. Kinoshita
<br...@yahoo.com.br> wrote:
> Hi all,
>
> Just wanted to let you guys know that I am successfully compiling and executing code using [functor] and Java 8. And am also using [functor] functional interfaces with lambdas.
>
> So instead of writing:
>
>
> UnaryPredicate isEven = new UnaryPredicate() {
> public boolean test(Integer obj) {
> return obj % 2 == 0;
> }
> };
>
> One can simply write:
>
> UnaryPredicate isEven = (Integer obj) -> { return obj % 2 == 0; };
>
> FWIW, Google Guava's Predicate [1] is not a functional interface, so it cannot be used with lambdas, as in the example above.
>
> I'll continue to experiment with [functor] and Java 8. There are only two open issues in Jira, one regarding generators (there's a branch with a proposal implementation) and another one about the equals() method in the [functor] API.
>
> I wrote a short blog post [2] about how I'm running Java 8 in Eclipse Juno, in case anyone is interested in trying it too. The code is hosted at GitHub [3].
>
> Cheers,
>
> [1] http://code.google.com/p/guava-libraries/source/browse/guava/src/com/google/common/base/Predicate.java
> [2] http://www.kinoshita.eti.br/2012/12/21/using-apache-commons-functor-functional-interfaces-with-java-8-lambdas/
> [3] https://github.com/kinow/try-lambdas
> Bruno P. Kinoshita
> http://kinoshita.eti.br
> http://tupilabs.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [functor] Using [fucntor] functional interfaces with Java 8 lambdas
Posted by Matt Benson <gu...@gmail.com>.
Very exciting! Thanks, Bruno!
Matt
On Fri, Dec 21, 2012 at 1:22 PM, Bruno P. Kinoshita <
brunodepaulak@yahoo.com.br> wrote:
> Hi all,
>
> Just wanted to let you guys know that I am successfully compiling and
> executing code using [functor] and Java 8. And am also using [functor]
> functional interfaces with lambdas.
>
> So instead of writing:
>
>
> UnaryPredicate isEven = new UnaryPredicate() {
> public boolean test(Integer obj) {
> return obj % 2 == 0;
> }
> };
>
> One can simply write:
>
> UnaryPredicate isEven = (Integer obj) -> { return obj % 2 == 0; };
>
> FWIW, Google Guava's Predicate [1] is not a functional interface, so it
> cannot be used with lambdas, as in the example above.
>
> I'll continue to experiment with [functor] and Java 8. There are only two
> open issues in Jira, one regarding generators (there's a branch with a
> proposal implementation) and another one about the equals() method in the
> [functor] API.
>
> I wrote a short blog post [2] about how I'm running Java 8 in Eclipse
> Juno, in case anyone is interested in trying it too. The code is hosted at
> GitHub [3].
>
> Cheers,
>
> [1]
> http://code.google.com/p/guava-libraries/source/browse/guava/src/com/google/common/base/Predicate.java
> [2]
> http://www.kinoshita.eti.br/2012/12/21/using-apache-commons-functor-functional-interfaces-with-java-8-lambdas/
> [3] https://github.com/kinow/try-lambdas
> Bruno P. Kinoshita
> http://kinoshita.eti.br
> http://tupilabs.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>