Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E93CD10EBD for ; Mon, 8 Jul 2013 17:03:35 +0000 (UTC) Received: (qmail 42082 invoked by uid 500); 8 Jul 2013 17:03:35 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 41863 invoked by uid 500); 8 Jul 2013 17:03:35 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 41855 invoked by uid 99); 8 Jul 2013 17:03:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jul 2013 17:03:35 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW X-Spam-Check-By: apache.org Received-SPF: error (nike.apache.org: local policy) Received: from [209.85.213.169] (HELO mail-ye0-f169.google.com) (209.85.213.169) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jul 2013 17:03:29 +0000 Received: by mail-ye0-f169.google.com with SMTP id m1so1693747yen.14 for ; Mon, 08 Jul 2013 10:02:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:from:to:references:in-reply-to:subject:date:mime-version :content-type:content-transfer-encoding:x-priority:x-msmail-priority :importance:x-mailer:disposition-notification-to:x-mimeole :x-gm-message-state; bh=ecreShMNp2XA/iv8xS51TEsPmSxLRZGLxbX7HMZ6H3w=; b=TuCVNDldZCCaOOWVrpfRbKiPLpSD5YFK72gbuFtH1FzolHnpmymYiH4IAv6/q4cXp7 RyyyghSuALo6gKmrxZAp6aRQSMFumBOfPswQqrzvPrEkOZrLNB9uk1mIu9/lIBRHUtkv TLUsKmHE42kudwpdLCF/nc8Nt0As15G4PsDw55SN5Fd772WwevqsjpGFuzgAEwI+Ub0t ccfLauBE+LJ9QstpscY2sSigfHEWnMMoVFuoMvalUsKT73gnUgmJ5ymtdSYRM9NJg9QG V/kMXp/4VnZZ4Ir6CM5AKwBqTzwwZ6h7YV7UG+vCnRmcNwGEoUa1+zKna9bkxcJwH1le BYqg== X-Received: by 10.236.72.105 with SMTP id s69mr12692498yhd.102.1373302966770; Mon, 08 Jul 2013 10:02:46 -0700 (PDT) Received: from RafaelDesktop (187-55-0-111.fnses700.dsl.brasiltelecom.net.br. [187.55.0.111]) by mx.google.com with ESMTPSA id g39sm38245123yhb.13.2013.07.08.10.02.44 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 08 Jul 2013 10:02:45 -0700 (PDT) Message-ID: From: "Rafael Santini" To: "Commons Developers List" References: <3E7DDCA7D6C643ED88A6FBB5EBC3B8B2@RafaelDesktop> In-Reply-To: Subject: Re: ObjectUtils Date: Mon, 8 Jul 2013 14:01:44 -0300 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 15.4.3555.308 X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3555.308 X-Gm-Message-State: ALoCoQmwJbgWwJCu06jBkGPooNa0iVIJBRGLH+9Nh8KBDONogrjeX+T1UciwbuO4jSingCtS/kPB X-Virus-Checked: Checked by ClamAV on apache.org Hi, The proposed method is related to objects. As we have StringUtils.isBlank(), isNotBlank(), isEmpty() etc., the ObjectUtils.isNotNull(Object... objs) is intended to check if all objects are not null. So, instead of if (obj1 != null && obj2 != null && obj3 != null && obj4 != null) { // Do something... } we have if (isNotNull(obj1, obj2, obj3, obj4) { // Do something... } The StringUtils.firstNonNull() returns the first object that is not null (equivalent to something that returns true if there is at least one object that is not null). The isNotNull() returns true if all objects are not null. Rafael Santini -----Mensagem Original----- From: Matt Benson Sent: Monday, July 08, 2013 1:20 PM To: Commons Developers List Subject: Re: Lang: ObjectUtils WRT #firstNonNull, I don't know why I couldn't find it before. I do now, and I agree it would seem to fit better in ArrayUtils. Matt On Mon, Jul 8, 2013 at 10:04 AM, J�rg Schaible wrote: > Hi Matt, > > Matt Benson wrote: > > > On Mon, Jul 8, 2013 at 8:22 AM, J�rg Schaible > > wrote: > > > >> Hi Hen, > >> > >> Henri Yandell wrote: > >> > >> > I don't see any value having the first two methods - replacing the > '==' > >> > sign is a bit too far in the 'provide simple methods' direction I > think > >> :) > >> > > >> > I think the third method is already in Lang as: > >> > > >> > ArrayUtils.contains(array, null); > >> > >> > >> Well, no, this is not, what the method does! > > > > > > Correct, but to be fair, it's simple enough to use this method to > > implement > > the desired check. Negate the result. > > > > > >> With Lang we could use now: > >> > >> ObjectUtils.firstNotNull(array) != null > >> > > > > I don't see such a method as this. > > > http://commons.apache.org/proper/commons-lang/javadocs/api-release/org/apache/commons/lang3/ObjectUtils.html#firstNonNull(T.. > .) > > > If it did exist, it still wouldn't > > implement the feature requested (check that no element of the array is > > null). I'm pretty sure !ArrayUtils.contains(array, null) is fine. > > I've re-read the original code and you're right. > > - J�rg > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org