XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Could
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Core 2.5.0
    • Component/s: None
    • Labels:
    • Complexity:
      Low

      Description

      Case:
      The ability to simplify the code for the getUniqueDiagnosesmethod in the DiagnosisServiceImpl class.

      Current state:
      Before the "while" loop is started, the iterator is taken, and then each element of the list is checked separately. It currently takes 7 lines of code.

      Solution:
      Use the removeif method from Collection class: diagnoses.removeIf(diagnosis -> !answers.add(diagnosis.getDiagnosis())). After the change, the code will occupy one line.

      Link to loop:
      https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/api/impl/DiagnosisServiceImpl.java#L108-L115

        Gliffy Diagrams

          Attachments

            Activity

              People

              Assignee:
              navareth Bartłomiej Rasztabiga
              Reporter:
              sacull Lukasz Debicki
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: