The ability to simplify the code for the getUniqueDiagnosesmethod in the DiagnosisServiceImpl class.
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.
Use the removeif method from Collection class: diagnoses.removeIf(diagnosis -> !answers.add(diagnosis.getDiagnosis())). After the change, the code will occupy one line.