Uploaded image for project: 'Commons Collections'
  1. Commons Collections
  2. COLLECTIONS-230

CollectionUtils.size(null) should return 0

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.2
    • 4.0-alpha1, 4.0
    • None
    • None

    Description

      Hello,

      CollectionUtils.size(null) currently throws IllegalArgumentException("Unsupported object type: null"). I think CollectionUtils.size(null) should return 0.

      Why?

      The aim of library is to minimize the amount of code that uses this library. In my experience, in the most cases null collections can be threated as as zero-length. Current behavior causes the need of many trivial null-checks.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              yozh Stepan Koltsov
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: