java interoperation; lambda to callbacks?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

java interoperation; lambda to callbacks?

Peter Lauck
Hey I have a quick question. Will jruby convert my lambdas to java callbacks? To be more specific, I'm working with JavaFX (with JRubyFX) and I have a method setCellValueFactory() that expects takes a java Callback as a parameter. Since Java 8 added lambdas, the java code might be something like this:
- Peter Lauck
Reply | Threaded
Open this post in threaded view
|

Re: java interoperation; lambda to callbacks?

Peter Lauck
col.setCellValueFactory( cellData -> cellData.getValue())

Would this code be equivalent to writing the jruby code:

col.set_cell_value_factory( lambda { |data| data.get_value  } )

Will jruby do the correct conversion? Perhaps I should use Proc instead of lambda?

Thanks in advance for the help

P.S. Sorry about splitting this up into 2 emails

- Peter Lauck

On Fri, May 22, 2015 at 1:44 PM, Peter Lauck <[hidden email]> wrote:
Hey I have a quick question. Will jruby convert my lambdas to java callbacks? To be more specific, I'm working with JavaFX (with JRubyFX) and I have a method setCellValueFactory() that expects takes a java Callback as a parameter. Since Java 8 added lambdas, the java code might be something like this:
- Peter Lauck

Reply | Threaded
Open this post in threaded view
|

Re: java interoperation; lambda to callbacks?

Peter Lauck
Well the method works with a lambda so I assume either jruby or jrubyfx is handling that conversion.

- Peter Lauck

On Fri, May 22, 2015 at 1:52 PM, Peter Lauck <[hidden email]> wrote:
col.setCellValueFactory( cellData -> cellData.getValue())

Would this code be equivalent to writing the jruby code:

col.set_cell_value_factory( lambda { |data| data.get_value  } )

Will jruby do the correct conversion? Perhaps I should use Proc instead of lambda?

Thanks in advance for the help

P.S. Sorry about splitting this up into 2 emails

- Peter Lauck

On Fri, May 22, 2015 at 1:44 PM, Peter Lauck <[hidden email]> wrote:
Hey I have a quick question. Will jruby convert my lambdas to java callbacks? To be more specific, I'm working with JavaFX (with JRubyFX) and I have a method setCellValueFactory() that expects takes a java Callback as a parameter. Since Java 8 added lambdas, the java code might be something like this:
- Peter Lauck