[jruby-user] Re: java interoperation; lambda to callbacks?
Peter Lauck <[email protected]> Fri, 22 May 2015 13:52:02 -0400
| Newsgroups | gmane.comp.lang.jruby.user |
|---|---|
| Message-ID | <CAJLVirUJ1JJf7-GQuxNYp56p0NW3rgFfBTeGzSUw7fCf4+zDzA@mail.gmail.com> |
--001a11440f3a532a210516af5186
Content-Type: text/plain; charset=UTF-8
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 <[email protected]> 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
>
--001a11440f3a532a210516af5186
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">col.setCellValueFactory( cellData -> cellData.getValue(=
))<div><br></div><div>Would this code be equivalent to writing the jruby co=
de:</div><div><br></div><div>col.set_cell_value_factory( lambda { |data| da=
ta.get_value =C2=A0} )</div><div><br></div><div>Will jruby do the correct c=
onversion? Perhaps I should use Proc instead of lambda?</div><div><br></div=
><div>Thanks in advance for the help</div><div><br></div><div>P.S. Sorry ab=
out splitting this up into 2 emails</div></div><div class=3D"gmail_extra"><=
br clear=3D"all"><div><div class=3D"gmail_signature"><div dir=3D"ltr">- Pet=
er Lauck</div></div></div>
<br><div class=3D"gmail_quote">On Fri, May 22, 2015 at 1:44 PM, Peter Lauck=
<span dir=3D"ltr"><<a href=3D"mailto:[email protected]" target=3D"_bl=
ank">[email protected]</a>></span> wrote:<br><blockquote class=3D"gmai=
l_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left=
:1ex"><div dir=3D"ltr">Hey I have a quick question. Will jruby convert my l=
ambdas 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:<br clear=3D"all"><div><div><div dir=3D"ltr">-=
Peter Lauck</div></div></div>
</div>
</blockquote></div><br></div>
--001a11440f3a532a210516af5186--