Uploaded image for project: 'Google Code-in'
  1. Google Code-in
  2. GCI-244

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

    XMLWordPrintable

    Details

    • Complexity:
      Low

      Description

      Replace this line https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/api/db/hibernate/HibernateConceptDAO.java#L1813

      with list.isEmpty()

       

      Background Information:

      Using Collection.size() to test for emptiness works, but using Collection.isEmpty() makes the code more readable and can be more performant. The time complexity of any isEmpty() method implementation should be O(1) whereas some implementations of size() can be O\(n).

       

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            dkayiwa Daniel Kayiwa
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated: