Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 97590 invoked from network); 30 Oct 2009 19:57:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 30 Oct 2009 19:57:12 -0000 Received: (qmail 95794 invoked by uid 500); 30 Oct 2009 19:57:11 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 95679 invoked by uid 500); 30 Oct 2009 19:57:10 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 95669 invoked by uid 99); 30 Oct 2009 19:57:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Oct 2009 19:57:10 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ted.dunning@gmail.com designates 209.85.222.190 as permitted sender) Received: from [209.85.222.190] (HELO mail-pz0-f190.google.com) (209.85.222.190) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Oct 2009 19:57:02 +0000 Received: by pzk28 with SMTP id 28so2134223pzk.27 for ; Fri, 30 Oct 2009 12:56:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type; bh=Lj5oJ7UijQ2gdJkHgAQQjZwsuQNP64mvU+XM5K9W1rk=; b=DbjPkrUr/QPVyP/nLIEElWlgbr5UhobswaT+LJlsZtEKQ9RsBqc5LrPWITAOxpsn5x 8lpXVFspXOh88nqOp5O1qt9QyFAiNQTeVEN5E4hse34/aTd93sVlaHv/d0Uk9oa9Rpnw ylep0nB0ca9FOgfLGwB7GX7JlGvXeFF7iRezM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=Vt6qdPzLvZadbi5LrYSC83J5pjevVaTYzCyqzBVYFje2WlxoX47bdGU2RvI2eeaPx9 Bps106Klr1CcOaMm340D4xl1fiTgvocYu7gBzMLPFXbldvWjWqGA1or6nJOll69GKjPJ i7RPwajNC2S8AT2dHpB4SuIy1taVKqO7e/P/M= MIME-Version: 1.0 Received: by 10.115.66.29 with SMTP id t29mr1463960wak.187.1256932601076; Fri, 30 Oct 2009 12:56:41 -0700 (PDT) In-Reply-To: <20091030133937.275350@gmx.net> References: <20091030133937.275350@gmx.net> From: Ted Dunning Date: Fri, 30 Oct 2009 12:56:21 -0700 Message-ID: Subject: Re: new feature: coalesce operator / method To: Commons Users List Content-Type: multipart/alternative; boundary=0016e648f31e31a27004772c6d98 X-Virus-Checked: Checked by ClamAV on apache.org --0016e648f31e31a27004772c6d98 Content-Type: text/plain; charset=UTF-8 Write up a JIRA and a patch and go for it! I would recommend that the name be "firstNonNull" rather than "coalesce". The verb coalesce implies things coming together rather than selecting one of many. On Fri, Oct 30, 2009 at 6:39 AM, thomas menzel wrote: > hi, > > after writing an if (x != null) {o = ...} else if (y != null) {o = } ... > cascade, i just thought that we could use a coalesce operator in java as > well.... > > > until sun will support this i think this could be hosted somewhere in the > commons.lang package: > > Operators.coalesce(final Object... object); > > this then would return the first non-null objecet from the given > list/array. > > alternatively this could also go on ObjectUtils. > > what do u think? > > -- > Neu: GMX DSL bis 50.000 kBit/s und 200,- Euro Startguthaben! > http://portal.gmx.net/de/go/dsl02 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org > > -- Ted Dunning, CTO DeepDyve --0016e648f31e31a27004772c6d98--