Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-531

Add defaultIfEmpty or nullIfEmpty to ArrayUtils

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 2.4
    • 3.0
    • lang.*
    • None

    Description

      StringUtils has method defaultIfEmpty and ObjectUtils has defaultIfNull. A parallel method is missing from ArrayUtils, and would provide a shorthand way of normalizing arrays. My first inclination was nullIfEmpty because no simple default value is readily available or easy to specify. But Henri mentioned that defaultIfEmpty might better parallel the other implementations. That option would work okay for me, as I can just specify null as the default.

      Attachments

        1. LANG-531.patch
          2 kB
          Henri Yandell

        Activity

          People

            Unassigned Unassigned
            guyr Guy Rouillier
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: