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

Add defaultIfEmpty or nullIfEmpty to ArrayUtils

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.4
    • Fix Version/s: 3.0
    • Component/s: lang.*
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: