Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1EB2117F80 for ; Wed, 15 Oct 2014 23:11:35 +0000 (UTC) Received: (qmail 68743 invoked by uid 500); 15 Oct 2014 23:11:34 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 68651 invoked by uid 500); 15 Oct 2014 23:11:34 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 68638 invoked by uid 99); 15 Oct 2014 23:11:34 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Oct 2014 23:11:34 +0000 Date: Wed, 15 Oct 2014 23:11:34 +0000 (UTC) From: "Joerg Schaible (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LANG-1050) Change nullToEmpty methods to generics MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LANG-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14173126#comment-14173126 ] Joerg Schaible commented on LANG-1050: -------------------------------------- bq. Using the toArray method like this will throw a ClassCastException, attempting to convert an empty array of Object to the desired type. Maybe you should first take a look into the existing unit tests before you spread such nonsense? > Change nullToEmpty methods to generics > -------------------------------------- > > Key: LANG-1050 > URL: https://issues.apache.org/jira/browse/LANG-1050 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* > Reporter: James Sawle > > Currently there are multiple Object based methods which could be replaced by a single generic method. > - public static Long[] nullToEmpty(final Long[] array) > - public static Integer[] nullToEmpty(final Integer[] array) > - public static Short[] nullToEmpty(final Short[] array) > - public static Character[] nullToEmpty(final Character[] array) > - public static Byte[] nullToEmpty(final Byte[] array) > - public static Double[] nullToEmpty(final Double[] array) > - public static Float[] nullToEmpty(final Float[] array) > - public static Boolean[] nullToEmpty(final Boolean[] array) > Recommendation, replace all of these with a single method that would also allow a defensive programming style when not using wrapped primitives. > - public static T[] nullToEmpty(final T[] array) -- This message was sent by Atlassian JIRA (v6.3.4#6332)