Hi Rémi, Groovy can choose the right method to call :)
assert ['1', '2', '3'] == [1, 2, 3].collect(Integer.&toString) Cheers, Daniel.Sun ________________________________ 发件人: Remi Forax [via Groovy] <ml-node+s329449n5736203...@n5.nabble.com> 发送时间: 2016年10月19日 19:29 收件人: daniel_sun 主题: Re: Lambda expression for Groovy 3 Daniel, you have also to test that Type::method work not only with static methods but also with instance method. The awful case being when you have a static method that takes an instance in parameter that 'overload' an instance method, like Integer.toString() and Integer.toString(int). Rémi ----- Mail original ----- > De: "daniel_sun" <[hidden > email]</user/SendEmail.jtp?type=node&node=5736203&i=0>> > à: [hidden email]</user/SendEmail.jtp?type=node&node=5736203&i=1> > Envoyé: Mercredi 19 Octobre 2016 12:23:09 > Objet: Re: Lambda expression for Groovy 3 > Hi Jochen, > > I plan to map Java's *::* to Groovy's *.&*, the following code is ok > now. What do you think about it? > > [1, 2, 3].stream().forEach(System.out.&println) // object method, > [1, 2, 3].stream().forEach(System.out::println) > [1, 2, 3].stream().forEach(Objects.&requireNonNull) // class method, [1, 2, > 3].stream().forEach(Objects::requireNonNull) > > Cheers, > Daniel.Sun > > > > -- > View this message in context: > http://groovy.329449.n5.nabble.com/Lambda-expression-for-Groovy-3-tp5736169p5736195.html > Sent from the Groovy Dev mailing list archive at Nabble.com. ________________________________ If you reply to this email, your message will be added to the discussion below: http://groovy.329449.n5.nabble.com/Lambda-expression-for-Groovy-3-tp5736169p5736203.html To unsubscribe from Lambda expression for Groovy 3, click here<http://groovy.329449.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5736169&code=cmVhbGJsdWVzdW5AaG90bWFpbC5jb218NTczNjE2OXwxMTQ2MjE4MjI1>. NAML<http://groovy.329449.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> -- View this message in context: http://groovy.329449.n5.nabble.com/Lambda-expression-for-Groovy-3-tp5736169p5736204.html Sent from the Groovy Dev mailing list archive at Nabble.com.