Re: DGM for first or default

2019-02-17 Thread Milles, Eric (TR Tech, Content & Ops)
me is the more general solution. From: Paul King Sent: Sunday, February 17, 2019 6:07 PM To: Groovy_Developers Subject: Re: DGM for first or default Groovy 2.5 still has JDK 7 as minimum whereas Groovy 3.0 has 8 as minimum. You can still add D

Re: DGM for first or default

2019-02-17 Thread Paul King
and you had to explicitly use "list*.prop". > > > *General question: *Are there limitations to using Java 8 stuff in Groovy > core? I'm not sure how Android support comes into play here. > > > -- > *From:* Milles, Eric (TR Tech, Con

Re: DGM for first or default

2019-02-17 Thread Milles, Eric (TR Tech, Content & Ops)
es, Eric (TR Tech, Content & Ops) Sent: Sunday, February 17, 2019 1:56 PM To: dev@groovy.apache.org Subject: Re: DGM for first or default I'd like to restart this discussion. I'm not sure if this should move to new JIRA ticket or Pull Request. There are a few open questions I'd

Re: DGM for first or default

2019-02-17 Thread Milles, Eric (TR Tech, Content & Ops)
res or Suppliers, how should that case be handled? I'm curious how often this might come up. From: Milles, Eric (TR Technology & Ops) Sent: Friday, October 19, 2018 10:54 AM To: dev@groovy.apache.org Subject: Re: DGM for first or default These may

Re: DGM for first or default

2018-10-19 Thread Milles, Eric (TR Technology & Ops)
logy & Ops) (mailto:eric.mil...@thomsonreuters.com>>) escribió: I think first() exists so there is a semantic pair for functional programming: first()/head() and tail() or init() and last() From: ocs@ocs mailto:o...@ocs.cz>> Sent: Thursday, October

Re: DGM for first or default

2018-10-18 Thread Mario Garcia
nal > programming: first()/head() and tail() or init() and last() > > -- > *From:* ocs@ocs > *Sent:* Thursday, October 18, 2018 1:20 PM > *To:* dev@groovy.apache.org > *Subject:* Re: DGM for first or default > > Well I thought *first* is smart

Re: DGM for first or default

2018-10-18 Thread Milles, Eric (TR Technology & Ops)
I think first() exists so there is a semantic pair for functional programming: first()/head() and tail() or init() and last() From: ocs@ocs Sent: Thursday, October 18, 2018 1:20 PM To: dev@groovy.apache.org Subject: Re: DGM for first or default Well I thought

Re: DGM for first or default

2018-10-18 Thread ocs@ocs
that proposal in the IDE. > > Are there any other small idioms like this that anyone has added as a > template to improve the editing experience? > From: Milles, Eric (TR Technology & Ops) > Sent: Thursday, October 18, 2018 12:19:42 PM > To: dev@groovy.apache.org <

Re: DGM for first or default

2018-10-18 Thread ocs@ocs
I suppose this is the equivalent now > that I think about it: > > list ? list.first() : defaultValue > > > From: ocs@ocs mailto:o...@ocs.cz>> > Sent: Thursday, October 18, 2018 12:07 PM > To: dev@groovy.apache.org <mailto:dev@groovy.apache.org> > Subje

Re: DGM for first or default

2018-10-18 Thread Mario Garcia
; why I'm asking if there is a simple equivalent. I suppose this is the > equivalent now that I think about it: > > > list ? list.first() : defaultValue > > > ---------- > *From:* ocs@ocs > *Sent:* Thursday, October 18, 2018 12:07 PM > *To:* de

Re: DGM for first or default

2018-10-18 Thread Milles, Eric (TR Technology & Ops)
y other small idioms like this that anyone has added as a template to improve the editing experience? From: Milles, Eric (TR Technology & Ops) Sent: Thursday, October 18, 2018 12:19:42 PM To: dev@groovy.apache.org Subject: Re: DGM for first or default &qu

Re: DGM for first or default

2018-10-18 Thread Milles, Eric (TR Technology & Ops)
rst() : defaultValue From: ocs@ocs Sent: Thursday, October 18, 2018 12:07 PM To: dev@groovy.apache.org Subject: Re: DGM for first or default Myself, I am not a huge fan of adding not-often-needed functionalities (and actually would add almost none of th

Re: DGM for first or default

2018-10-18 Thread Paolo Di Tommaso
ouch.. true! if so: list ? list.first() : defaultValue p On Thu, Oct 18, 2018 at 7:07 PM ocs@ocs wrote: > Myself, I am not a huge fan of adding not-often-needed functionalities > (and actually would add almost none of those discussed lately); > nevertheless... > > On 18 Oct 2018, at 6:

Re: DGM for first or default

2018-10-18 Thread ocs@ocs
P.S. Oh, and when I am writing anyway — please, do not abuse the “overloaded” methods which differ just by their argument lists (myself, I consider them always at best suspicious; mostly plain wrong). Instead of the suggestion below, if something like that is accepted, it would be much better to

Re: DGM for first or default

2018-10-18 Thread ocs@ocs
Myself, I am not a huge fan of adding not-often-needed functionalities (and actually would add almost none of those discussed lately); nevertheless... > On 18 Oct 2018, at 6:48 PM, Paolo Di Tommaso > wrote: > > -1, it can be easily done as: > list.first() ?: defaultValue ... this won't work

Re: DGM for first or default

2018-10-18 Thread Mauro Molinari
Isn't it equivalent to something like this? |def elem = collection?.first()?: defaultValue|| ||def elem = collection?.first()?: defaultSupplier()|| | Mauro Il 18/10/2018 17:39, Milles, Eric (TR Technology & Ops) ha scritto: I see there are the following DGMs for getting first element of a "co

Re: DGM for first or default

2018-10-18 Thread Paolo Di Tommaso
-1, it can be easily done as: list.first() ?: defaultValue p On Thu, Oct 18, 2018 at 6:45 PM Daniel.Sun wrote: > +0 from me. > P.S. we should add similar DGM for `last` too? > > Cheers, > Daniel.Sun > > > > > - > Daniel Sun > Apache Groovy committer > Blog: http://blog.sunlan.me > Twitter

Re: DGM for first or default

2018-10-18 Thread Daniel.Sun
+0 from me. P.S. we should add similar DGM for `last` too? Cheers, Daniel.Sun - Daniel Sun Apache Groovy committer Blog: http://blog.sunlan.me Twitter: @daniel_sun -- Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html