Commons Lang
  1. Commons Lang
  2. LANG-173

[lang] add isEmpty method to ArrayUtils

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: Other

      Description

      Hi,

      I would like to see a new method added to ArrayUtils which checks if an array is
      empty or null. This method could look like this:

      /**

      • <p>Checks if an array is empty or null.</p>
        *
      • @param array the array to check, may be null
      • @return <code>true</code> if the array is empty or null
        */
        public static boolean isEmpty(final Object[] array) {
        return (array == null) || (array.length == 0);
        }

      is it possible to add such a method?

      thanks
      Maarten Coene

        Activity

        Mark Thomas made changes -
        Workflow jira [ 12370116 ] Default workflow, editable Closed status [ 12602077 ]
        Henri Yandell made changes -
        Fix Version/s 2.1 Final [ 12311701 ]
        Henri Yandell made changes -
        Affects Version/s unspecified [ 12311647 ]
        Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
        Project Commons [ 12310458 ] Commons Lang [ 12310481 ]
        Component/s Lang [ 12311121 ]
        Fix Version/s 2.1 Final [ 12311659 ]
        Key COM-1060 LANG-173
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 26243 12341211
        Hide
        Henri Yandell added a comment -

        2.1 released, closing.

        Show
        Henri Yandell added a comment - 2.1 released, closing.
        Hide
        ggregory@seagullsw.com added a comment -

        I've add null tests for the testIsEmpty methods.

        Show
        ggregory@seagullsw.com added a comment - I've add null tests for the testIsEmpty methods.
        Hide
        Fredrik Westermarck added a comment -

        The code is now commited in HEAD.

        Show
        Fredrik Westermarck added a comment - The code is now commited in HEAD.
        Hide
        Fredrik Westermarck added a comment -

        I have already added the method - and their primitives counterpats. The code is
        not yet commited however, I'll commit it later if no one objects.

        Show
        Fredrik Westermarck added a comment - I have already added the method - and their primitives counterpats. The code is not yet commited however, I'll commit it later if no one objects.
        Hide
        Maarten Coene added a comment -

        and is it also possible to add the same method for the primitive type arrays ?

        thanks,
        Maarten

        Show
        Maarten Coene added a comment - and is it also possible to add the same method for the primitive type arrays ? thanks, Maarten
        Maarten Coene created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Maarten Coene
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development