public static Set<NurseViewPrescriptionWrapper> create(final Set<NurseViewPrescriptionDTO> nurseViewPrescriptionDTOs) {
return nurseViewPrescriptionDTOs.stream()
.map(new Function<NurseViewPrescriptionDTO, NurseViewPrescriptionWrapper>() {
@Override
public NurseViewPrescriptionWrapper apply(NurseViewPrescriptionDTO input) {
return new NurseViewPrescriptionWrapper(input);
}
})
.collect(Collectors.toSet());
}
I convert above code to java 8 lamda function as below.
public static Set<NurseViewPrescriptionWrapper> create(final Set<NurseViewPrescriptionDTO> nurseViewPrescriptionDTOs) {
return nurseViewPrescriptionDTOs.stream()
.map(input -> new NurseViewPrescriptionWrapper(input))
.collect(Collectors.toSet());
}
Now, I am receiving sonar issue, like Lambdas should be replaced with method references , to '->' this symbol. How i can fix this issue ?