Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-5030

Collection.isEmpty() should be used to test for emptiness

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Should
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Core 2.1.0
    • Component/s: None
    • Labels:
      None
    • Complexity:
      Low

      Description

      There are ~40 checks for whether a collection is or is not empty using the Collection.size() and a less than or greater than 0.

      It is cleaner to use the Collection.isEmpty()

      Refer to sonar

      https://ci.openmrs.org/sonar/drilldown/issues/1865?severity=CRITICAL

      to find the related code.

      The rule that is violated is "Collection.isEmpty() should be used to test for emptiness" which can be found under the severity critical.

        Attachments

          Activity

            People

            • Assignee:
              reubenv Reuben Varghese
              Reporter:
              teleivo Ivo Ulrich
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: