Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 83D98200C80 for ; Thu, 11 May 2017 05:10:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 82779160BC6; Thu, 11 May 2017 03:10:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C8C2A160B9C for ; Thu, 11 May 2017 05:10:06 +0200 (CEST) Received: (qmail 49467 invoked by uid 500); 11 May 2017 03:10:05 -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 49455 invoked by uid 99); 11 May 2017 03:10:05 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 May 2017 03:10:05 +0000 Received: from mail-oi0-f53.google.com (mail-oi0-f53.google.com [209.85.218.53]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 94AA71A031E for ; Thu, 11 May 2017 03:10:05 +0000 (UTC) Received: by mail-oi0-f53.google.com with SMTP id b204so16048799oii.1 for ; Wed, 10 May 2017 20:10:05 -0700 (PDT) X-Gm-Message-State: AODbwcA8I4+rmgtheoc2HWlc80naSym/mOoCI0IZ0qnokYQEn10s2qwD bFo4KatLXxmC6xBENVop5A0WCkz2AQ== X-Received: by 10.157.23.10 with SMTP id i10mr3849035ota.221.1494472204685; Wed, 10 May 2017 20:10:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.11.241 with HTTP; Wed, 10 May 2017 20:10:03 -0700 (PDT) Received: by 10.157.11.241 with HTTP; Wed, 10 May 2017 20:10:03 -0700 (PDT) In-Reply-To: References: From: "Javen O'Neal" Date: Wed, 10 May 2017 20:10:03 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Pair of nulls To: Commons Developers List Content-Type: multipart/alternative; boundary=f403043c3a88e31b3c054f36ecca archived-at: Thu, 11 May 2017 03:10:07 -0000 --f403043c3a88e31b3c054f36ecca Content-Type: text/plain; charset=UTF-8 +1 The of method should check if all elements are null, and if so to return the NULL singleton. This would reduce the number of objects created and garbage collected. So long as ImmutablePair and ImmutableTriple classes are final (not subclassable), then identity checking could be used in place of equality checking when comparing against a null tuple. This would be marginally faster. Any preference of being explicit (redundant) here? ImmutablePair.NULL_PAIR and ImmutableTriple.NULL_TRIPLE On May 10, 2017 7:35 PM, "Gary Gregory" wrote: Hi All, Any thoughts for or against adding the following to ImmutablePair: /** * An immutable pair of nulls. */ // This is not defined with generics to avoid warnings in call sites. @SuppressWarnings("rawtypes") public static final ImmutablePair NULL = ImmutablePair.of(null, null); Same for ImmutableTriple. ? Thank you, Gary -- E-Mail: garydgregory@gmail.com | ggregory@apache.org Java Persistence with Hibernate, Second Edition JUnit in Action, Second Edition Spring Batch in Action Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory --f403043c3a88e31b3c054f36ecca--