A question about lambda expressions without any sugar

74 views
Skip to first unread message

Sven L

unread,
Aug 7, 2012, 3:49:48 AM8/7/12
to xtend...@googlegroups.com
Hi!

i would like to see a lamba expression without any syntactic sugar. I wrote the following piece of code:

val (Person, Person)=>int le = ([ Person a, Person b |
    // ...
])

Collections::sort(collection, le)

1. What is the type that is automatically infered for the variable le? Can I replace "(Person, Person)=>int" with something else? Something with org.eclipse.xtext.xbase.lib.Functions.... or org.eclipse.xtext.xbase.lib.Procedures.... ?

Its not like that I want to write my lambda expressions this way. I'm just curious. ;-)

Best
Sven

Sven Efftinge

unread,
Aug 7, 2012, 3:58:24 AM8/7/12
to xtend...@googlegroups.com
It's Functions.Function2<? super Person, ? super Person, ? extends Integer>
You can check yourself by looking at the generated code (use the generated source view).

Sven
Reply all
Reply to author
Forward
0 new messages