commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (LANG-1050) Change nullToEmpty methods to generics
Date Thu, 16 Oct 2014 22:36:33 GMT


ASF GitHub Bot commented on LANG-1050:

GitHub user jamessawle opened a pull request:

    LANG-1050 Added new generic emptyToNull array method

    Based upon the comments in [JIRA](, I
have implemented a new generic defensive programming method for handling null arrays. The
current object methods have been modified to use the method to reduce maintenance. The wrapper
(and Object and Class) empty arrays have been deprecated as are no longer needed; however,
are kept to maintain binary compatibility.

You can merge this pull request into a Git repository by running:

    $ git pull LANG-1050

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #31
commit f1016b4d7a48910bc014b15afe897b6112c631cd
Author: James Sawle <>
Date:   2014-10-16T22:27:57Z

    LANG-1050 Added new generic method, added 3 tests and deprecated Object based empty arrays.


> Change nullToEmpty methods to generics
> --------------------------------------
>                 Key: LANG-1050
>                 URL:
>             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> T[] nullToEmpty(final T[] array)

This message was sent by Atlassian JIRA

View raw message