From dev-return-5508-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Thu Oct 18 19:07:57 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id AF70218064E for ; Thu, 18 Oct 2018 19:07:56 +0200 (CEST) Received: (qmail 38203 invoked by uid 500); 18 Oct 2018 17:07:55 -0000 Mailing-List: contact dev-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list dev@groovy.apache.org Received: (qmail 38193 invoked by uid 99); 18 Oct 2018 17:07:55 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Oct 2018 17:07:55 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id BCB15C6AE7 for ; Thu, 18 Oct 2018 17:07:54 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 5.063 X-Spam-Level: ***** X-Spam-Status: No, score=5.063 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=2, KAM_INFOUSMEBIZ=0.75, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_NONE=-0.0001, URI_HEX=1.313] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id SX8gMfP1Y4Vn for ; Thu, 18 Oct 2018 17:07:52 +0000 (UTC) Received: from smtp1.czechia.com (smtp1.czechia.com [217.198.120.59]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 99F365F170 for ; Thu, 18 Oct 2018 17:07:52 +0000 (UTC) Received: from [10.0.0.140] (unknown [77.240.103.197]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: ocs@ocs.cz) by smtp1.czechia.com (Postfix) with ESMTPSA id 777D62010DFBA for ; Thu, 18 Oct 2018 19:07:44 +0200 (CEST) From: "ocs@ocs" Content-Type: multipart/alternative; boundary="Apple-Mail=_F44DC7D2-4FDD-4BF2-855B-EE0DC28D6E6C" Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: DGM for first or default Date: Thu, 18 Oct 2018 19:07:43 +0200 References: <1539881122104-0.post@n5.nabble.com> To: dev@groovy.apache.org In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3445.9.1) --Apple-Mail=_F44DC7D2-4FDD-4BF2-855B-EE0DC28D6E6C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 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: >=20 > -1, it can be easily done as:=20 > list.first() ?: defaultValue ... this won't work in case the first object is a Groovy False (e.g., an = empty string, or a plethora of others). All the best, OC >=20 >=20 > p >=20 > 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? >=20 > Cheers, > Daniel.Sun >=20 >=20 >=20 >=20 > ----- > Daniel Sun=20 > Apache Groovy committer=20 > Blog: http://blog.sunlan.me =20 > Twitter: @daniel_sun=20 >=20 > -- > Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html = --Apple-Mail=_F44DC7D2-4FDD-4BF2-855B-EE0DC28D6E6C Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii 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 <paolo.ditommaso@gmail.com> wrote:

-1, it can be easily done as: 
list.first() ?: = defaultValue

... this won't work in case the first object is a = Groovy False (e.g., an empty string, or a plethora of = others).

All the = best,
OC


p

On Thu, Oct 18, 2018 at 6:45 PM Daniel.Sun <sunlan@apache.org> = 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: @daniel_sun

--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html<= br class=3D"">

= --Apple-Mail=_F44DC7D2-4FDD-4BF2-855B-EE0DC28D6E6C--